I developed a portable WebServer, and I am also creating a portable console to use Composer.
I have a problem. I need to create a plugin to add additional behavior to Composer.
I need that when downloading any package from Composer, it should edit the βscriptsβ composer.json of this package so that it works on the portable console.
When loading Laravel, for example:
Original composer.json:
{ "name": "laravel/laravel", ... "scripts": { "post-root-package-install": [ "php -r \"file_exists('.env') || copy('.env.example', '.env');\"" ], ... }, ... }
composer.json edited by the plugin:
{ "name": "laravel/laravel", ... "scripts": { "post-root-package-install": [ "F:/portable_php_path/php.exe -r \"file_exists('.env') || copy('.env.example', '.env');\"" ], ... }, ... }
- Please note that a physical path was created for php.exe, since in the portable version it can be in any way.
(My question is to create a composer plugin. I have no problem editing composer.json with PHP.)
I read the tutorial for creating a plugin on the composer's website, but I was confused. ( https://getcomposer.org/doc/articles/plugins.md )
If there is another way to do this, it is also interesting. I accept other suggestions and ideas.
Thanks to everyone who can help.
[Sorry my bad english]
php composer-php
Gilsones
source share