Distributing via GitHub

By default, the Packagist repository is the only registered repository in Composer. We can add more repositories to our Magento project by declaring them in composer.json. This way we get to register our own git repository as a source of packages, as follows:

composer config repositories.magelicious-royal-trek git [email protected]:foggyline/Magelicious_RoyalTrek.git

This command results in the modified composer.json file, with the repositories key amended as follows:

"repositories": {
"0": {
"type": "composer",
"url": "https://repo.magento.com/"
},
"magelicious-royal-trek": {
"type": "git",
"url": "[email protected]:foggyline/Magelicious_RoyalTrek.git"
}
},

We can see our magelicious-royal-trek entry added in there. The git value used for the type key tells the Composer we are using the git repository, located at the URL provided via the url key. The composer and git are not the only two values supported for the type. The actual type value could have easily been any other type of supported version control system:

We could also have simply used the vcs value for the type key, and relied on Composer's VCS driver to automatically detect the type based url value.

If we now execute composer require magelicious/royal-trek:dev-master, Composer will install our shipping module. While this new repositories approach works well, it is somewhat more suited for distributing private Magento extensions. Whenever we wish to distribute our extension publicly, a Packagist is a more convenient way to go.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.114.38