How to clone and setup Laravel project from GitHub
Published: 2022-09-07 18:13:25

Knowing how to clone and setup your Laravel project from GitHub is one of the most important thing you can know as a software developer. It gives you the ability to have access to millions of open source laravel projects out there.

In this content, I will be dropping a clear steps on how to clone laravel projects from github.

**Step 1**
**Locate the Repository**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kr100hluza5f2ujcd74p.png)

If you already have a Laravel project you want to clone before now, it is advisable you copy the repository link as directed on the snapshot above.

**Step 2**
**Move to Visual Studio Code Editor**


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2mhwit2poumk60qbent4.PNG)

On VS Code Editor, go to `Source Control Tab` or use `Ctrl+Shift+G` to locate the control source tab as shown on the image above. 

**Step 3**
**Clone Repository**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/louxzm7kfbuqo4s6xxn9.png)

Click on `Clone Repository`, then enter the repository link copied and click on clone.

**Step 4**
**Select Local Directory**


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7wekgyhsnb3m2mzv3jtd.PNG)

After Step 3, the computer automatically promote you to select the local directory to clone the Laravel Project into.

For me, I'm cloning the project into my `htdocs` because I'm using XAMPP Server.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/znqlv776ayxqahjybd04.PNG)

At this point, your project is now cloning.

**Step 5**
**Open Cloned File**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/poqsvqwz9koplu6hep58.PNG)

After our project has successfully been cloned, we can now go ahead to open it.

**Step 6**
**Setting Up Project**

Laravel projects requires extra setups before it can run on your local computers.

First, we are going to install Node Module and Vendor files.

To install node module run `npm install` on your VS Code Terminal and wait for it to complete.

To install your Vendor file run `composer install` on your VS Code Terminal and wait for it to complete.


**Step 7**
**Setup .env file**

To setup your `.env`, kindly duplicate your `.env.example` file and rename the duplicated file to `.env`.


**Step 8**
**Setup Database**

For this content, I'm using `PHP MyAdmin Database`.

On your `.env` file, locate this block of code below.

```
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=subnetweb
DB_USERNAME=root
DB_PASSWORD=
```

The block of code above represents your Database connection and `subnetweb` is my database name, which you can create your database name to be something else.


**Step 9**
**Commands**

To finalize this everything, run the following commands on your terminal.

```
npm run dev

php artisan key:generate

php artisan migrate

php artisan server
```

**Step 10**
**Conclusion**

If you finished step 1 - 10 successfully, congratulation!!! you have just cloned your first Laravel Project from GitHub.

Click [here](https://www.youtube.com/watch?v=w261-WZ2WSA) to follow my youtube tutorial on this content.