Composer - How to require from github

Composer - How to require from github

By default composer will look up onto packagist.org, but what if we want to require the package / library from github repository instead of packagist.org?

to do that, we need to do 2 steps.

1. Configure The Configuration

First of all, we need to setup the configuration, so there's other pool for composer to look-up onto. It's the example of composer config for package of https://github.com/fiko/magento2-adminurl

composer config repositories.fiko-magento2-adminurl git git@github.com:fiko/magento2-adminurl.git

2. Require the package

Then, once composer config is complete, we just need to composer require package name that present on composer.json of that package. For the preceding example, we need to use this command :

composer require fiko/magento2-adminurl:dev-master