Setting Up a Laravel Project from Git
Prerequisites
Before getting started, make sure the following tools are installed on your system:
-
Git: A version control system used to clone and manage your Laravel project.
-
š Download: https://git-scm.com/
-
š¦ To verify installation, run:
git --version
-
-
PHP: Laravel requires PHP 7.3 or higher.
-
š¦ To check your version:
php -v
-
-
Composer: A dependency manager for PHP, required to install Laravel packages.
-
š Download: https://getcomposer.org/
-
š¦ To verify installation:
composer --version
-
-
Web Server: Laravel includes a built-in development server, but for production use Apache or Nginx.
-
Database: Ensure you have a supported database system (e.g., MySQL, PostgreSQL, or SQLite) installed.
Steps to Clone and Set Up the Project
1️⃣ . Clone the Project Repository
Open your terminal and run the following command to clone the Laravel project:
git clone https://gitlab.com/SoengSouy/sample-crud-bootstrap-with-laravel
š” Replace the URL with your project's repository if you're using a different source.
2️⃣ . Navigate to the Project Directory
cd sample-crud-bootstrap-with-laravel
3️⃣ Install Dependencies
Use Composer to install the required PHP dependencies:
composer install
4️⃣ . Set Up the Environment File
Copy the example environment file and rename it to .env
:
cp .env.example .env
Then, open the .env
file in your preferred editor and configure your database and other settings.
5️⃣ . Generate Application Key
php artisan key:generate
This will set the APP_KEY
value in your .env
file, which is essential for session and encryption services.
6️⃣ Configure Database Credentials
In the .env
file, update the following lines to match your local database setup:
DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=your_db DB_USERNAME=root DB_PASSWORD=your_password
7️⃣ . Run Database Migrations
Execute the following command to create the necessary database tables:
php artisan migrate
Serve the Application
Start the Laravel development server:
php artisan serve
Your application will be accessible at:
http://localhost:8000