Apr 20, 2020 in

Sometime you would want to require a module or library from Github instead some packagist or drupal.org. Here's how you would do this. In the 'repositories' section of your composer.json file, add your library like this:

    "repositories": [
            "type": "composer",
            "url": "https://packages.drupal.org/8"
            "type": "package",
            "package": {
                "name": "harvesthq/chosen",
                "version": "1.8.7",
                "source": {
                    "url": "https://github.com/harvesthq/chosen.git",
                    "type": "git",
                    "reference": "master"

When you did this, it is as simple as running the following command:

composer require harvesthq/chosen