How to Clone and Set Up a Laravel Project
Before starting a Laravel project, it’s important to ensure your development environment is properly configured. This guide will walk you through the prerequisites and the steps to clone and set up a Laravel project from a Git repository.
Prerequisites
Make sure the following tools are installed on your system:
1. Git
Git is a version control system used to track changes in source code.
Download: https://git-scm.com/
Check installation:
git --version
2. PHP
Laravel requires PHP 7.3 or higher.
Check your PHP version:
php -v
3. Composer
Composer is a dependency manager for PHP. It's essential for installing Laravel and its packages.
Download: https://getcomposer.org/
Check installation:
composer -V
4. Web Server
Laravel comes with a built-in development server, but for production, Apache or Nginx is recommended.
5. Database
If your Laravel project uses a database, install the appropriate DBMS (e.g., MySQL, PostgreSQL, or SQLite).
Steps to Clone and Set Up the Project
1. Clone the Repository
Open your terminal, navigate to the directory where you want the project, and run:
git clone https://github.com/StarCodeKh/HR-Management-System-Built-on-Laravel-11.git
2. Navigate to the Project Directory
cd HR-Management-System-Built-on-Laravel-11
3. Install Composer Dependencies
composer install
4. Create the .env
Configuration File
cp .env.example .env
Edit the .env
file to set your database and environment configuration.
5. Generate Application Key
php artisan key:generate
6. Set Up Database Credentials
Open .env
and update the database section:
DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=your_database_name DB_USERNAME=your_database_user DB_PASSWORD=your_database_password
7. Run Database Migrations
php artisan migrate
This will create the necessary tables in your database.
8. Serve the Application
php artisan serve
By default, the app will be accessible at http://localhost:8000
You’re All Set!
You’ve successfully cloned and set up a Laravel project on your local machine. You can now begin developing or customizing the application.