I've developed a WebServer Portable and I'm also creating a portable console to use Composer.
I have a problem. I need to create a plugin for Composer.
I need you to download any package with Composer, it will edit the compositor.json "scripts" of that package, so that it works on the portable console.
When you download 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');\""
],
...
},
...
}
- Note that a physical path was generated for php.exe, because in the portable version, it could be in any path.
(My question is about creating the plugin for Composer. I have no problem editing the compositor.json with PHP)
I read the tutorial to create a plugin on the Composer site, but I was confused. ( link )
If you have another way of doing this, it's also interesting. I accept other suggestions and ideas.
Thanks to anyone who can help.