I am developing a PHP component called php-app-config using composer . This component, which is required by another project and installed using composer install , should look for configuration files inside the config folder of the root package , something like root_package/config/config.yml .
./config/config.yml should exist only in the root package, and not inside the component imported "require:" in composer.json , as shown 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 may be a utility for web applications or a command line. Is there a way to get the root package path using composer? If not, which way is better?
source share