I want to provide a script that can be installed with PHP's package manager composer and that must be configurable.
With composer, we can easily define vendor binaries.
However, I don't see any possibility to configure them.
One could include a configuration file from within the package. However, name and location of the vendor directory are configurable, so this will not be very reliable.
For comparison: With Python's package manager pip, we can use environment variables for the configuration. We can set the environment variables while activating the virtual environment, e.g. by using tools like the virtualenvwrapper.
There must be at least experiments with similar approaches in the PHP community.
Addendum: The story behind
I have scripts that synchronize the databases and user generated files for test versions of websites.
For Django sites, I'm always using the same scripts, they rely on environment variables that I define with the virtualenvwrapper.
For Drupal sites, one can achieve a lot with drush.
But for Wordpress, I cannot find a simple and clean tool. It should
To be honest, I'm missing the virtualenvwrapper in PHP. The virtualenvwrapper is a linux script that basically does two things:
I think, what are you looking for is probably something like a library https://packagist.org/packages/hiqdev/composer-config-plugin
It is a quite popular library and managed also by a creator/contributor of the Yii/2 framework Samdark https://packagist.org/users/samdark/ or the creator of the asset-packagist hiqdev https://packagist.org/users/hiqdev/
This Composer plugin provides assembling of configurations distributed with composer packages. It allows putting configuration needed to use a package right inside of the package thus implementing a plugin system. The package becomes a plugin holding both the code and its configuration.
Usage:
"extra": {
"config-plugin-output-dir": "path/relative-to-composer-json",
"config-plugin": {
"params": [
"config/params.php",
"?config/params-local.php"
],
"common": "config/common.php",
"web": [
"$common",
"config/web.php"
],
"other": "config/other.php"
}
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With