I'm developing a PHP component called php-app-config using composer.
This component, once required by another project, and installed using composer install
, should look for config files inside the config folder of the root package, something like root_package/config/config.yml
.
The ./config/config.yml
should exists only in the root package and not inside the component imported by the "require:" in composer.json
, as below:
▾ root-package/
▸ bin/
▸ build/
▾ config/
▸ locales/
config.yml
▸ src/
▸ tests/
▾ vendor/
▸ composer/
▸ phpdocumentor/
▸ phpspec/
▸ phpunit/
▾ robotdance/
▾ php-app-config/
▾ src/
Config.php -> how to get the root "config/config.yml" path from here?
▸ tests/
composer.json
composer.lock
phpunit.xml
README.md
The root package can be a web app or command line utility. Is there any way to get the root package path using composer? If not, what is the better way?