How to Contribute to Laravel: A Step-by-Step Guide
Tags: laravel, opensource
Published: 2024-06-23 02:01:16

Every laravel developer has this wish to contribute to laravel, but it's hard to find a starting point on how to do that. where to start, how this, what that, all these questions and searching on the internet won't be much of a help. There are many articles on how to do laravel but almost no detailed information on how to contribute to this master framework.

In this article, we will try to find out answers to some of those questions.

## Familiarize Yourself with Laravel

Before jumping in the contributing, I would highly recommend that you familiarize yourself with laravel. it can be done in the following three ways.

- Read the Documentation
- Build Projects
- Engage with the Community

If you think you have overcome the above-mentioned requirement, let's get started.

## Fork the Laravel Framework Repository

The first step in the contribution is to fork the [laravel framework repository](https://github.com/laravel/framework) in your GitHub account.

![laravel fork](https://msamgan.dev/storage/images/5rGQ5hz648bfJDgwbYyKfWg7ayaiVnyRVnuXveFS.png)

Pro Tip: While forking uncheck the latest release branch only check. Else you will have only the latest release branch in your account.

## Local Setup

Follow the steps below to set up the workflow on your local machine.

### Create a new Laravel project

Create a new laravel project. You can get instructions for that from [here](https://laravel.com/docs/11.x/installation). As of this time, laravel 11 is the latest version so that will be our base for the work. Once you have the setup up and running we will start our development changes. You can also use the following command.

```
composer create-project laravel/laravel laravel-app
```

### Clone the Fork on your machine

Use the following command to clone the fork to your local machine

```
git clone "path to your git repository"
```
Pro Tip: I suggest making the directory structure as shown in the picture below.

![directory structure](https://msamgan.dev/storage/images/oxtS2Ae9AdoEB40Of7tpZQo9lxZS8HpCurQDYTN1.png)

## Updating the composer.json

Once all the things are in place, update the content of composer.json with the following content.

```
"minimum-stability": "dev",
"repositories": [
        {
            "type": "path",
            "url": "../laravel-framework"
        }
    ]
```
After that run composer update

Now you have your Laravel app using your local copy of the laravel framework.

## Create a Feature or Bug Branch

Create a [new branch](https://github.com/laravel/framework/issues/new/choose) on your local machine and make the required changes. You can use the following command to create a new branch.

```
git checkout -b feature/new-feature

```

Once the changes are done, push the changes to your repository.

## Create a new Issue and submit the PR about that issue.

Create a [new issue](https://github.com/laravel/framework/issues/new/choose) in the parent repository, in our case the [laravel/framework](https://github.com/laravel/framework) repository. Be as detailed as you can be for the update you are doing.

![pull request](https://msamgan.dev/storage/images/2A6fYt3y2YoKajwNSV6Y3DnsBp2oIJJJOMf2hLIH.png)

And there we go. You have your contribution done. Ones verified by the Laravel maintainers it can move forward.

Fell free to comment below in case of feedback or questions.

{% youtube fBdlp1w32TA %}