composer/installers is for PHP package authors to require in their composer.json
. It will install their package to the correct location based on the specified package type.
website:
Example of the composer.json file in the template folder
add the following code to the root of the template folder with the correct name and update the type to whatever is easier for you
1 2 3 4 5 6 7 8 9 10 11 | { "name": "riksi_wordpress_theme", "type": "</code>wp-theme<code>", "require": { "composer/installers": "~1.0" } } |
Using the installer in the project
In the main composer file on the project, you need to add the following details:
please note, the following code, allow you to download the code from GitLab repo with the correct version and add it to the correct path on the site
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | { "name": "name of the package", "repositories": [ { "type": "gitlab", }, ], "require": { "composer/installers": "~1.0.0", "package/name": "1.0.0" //version of the package }, "config": { "gitlab-oauth": { "gitlab.com": "the_auth_key" } }, "extra": { "installer-paths": { "your/custom/path/{$name}/": ["type:wordpress-plugin"] } } } |
and finally, run the composer install and check the path