Cheatsheet - Register a private github repository in a Laravel app

Nav • March 10, 2021

package-development laravel

How to register a package in Laravel from a private github repository, without registering it with packagist.

Update the composer file of your project. Add the following to your require or require-dev whichever one fits your needs.

"your-github-username/private-repo-name": "dev-master"

Add the location for that package. Add a new key and value:

"repositories": [
    {
        "type": "git",
        "url" : "https://github.com/your-github-username/private-repo-name"
    }
],

Now you can run

composer update

Your private repository, should now be registered in your project. Whenever you update your repo, just run composer update, and it will sync the repo.