Installing a private package with composer

Most of PHP framework now a day uses composer.json to install packages. In this article I am going to show you an overview on adding PHP packages from your private repository to a composer.json file.

1. Configure Composer

Add this line into your composer.json to point to your private repository.

2. Create an SSH key

Create an SSH Key on the machine on which you want to install the package.

If you are on a development machine, you probably want to add the SSH key to your GitHub or Bitbucket account. This gives you access to all private repositories on your account.

For your reference you can visit the link below:

3. Run composer

Lastly, you can run composer require or composer install to install the package.

That’s it! You can now start adding your packages from your private repositories.  Happy Coding!!