Contents
How to get the root package path using composer?
You can use composer’s very own \\Composer\\Factory::getComposerFile (); to get to the project root directory: And with your case, you can access your root-package/config/config.yml by: Don’t forget to add composer to your dependencies for the \\Composer\\Factory::class to be available:
How to add composer to an existing website?
Composer configuration ( composer. json, composer. lock, etc.), drush, and the vendors directory will be placed outside of your webroot. Your original webroot will contain a new folder called web /, where the actual website resides.
How to add Drupal modules to composer project?
You can add all your modules at once using composer require drupal / module – name -1 drupal / module – name -2 drupal / module – name – i. Use composer require — dev drupal / to add a module to the require-dev section of the composer. json file. Run composer install from your project directory (e.g., /var/ www / sites / new_html / ).
Where can I find the docroot variable in composer?
The docroot variable exists in a few plain text files. Some fixup is required if the user wants to select something else. We could in principal read DOCROOT from composer.json in post-install.sh, but it would still be necessary to make multiple changes to composer.json and .gitignore, so perhaps this is not worthwhile.
How to check that composer has the correct path?
Check that composer now has the correct path: cd ~/.composer echo $PATH If you see the path including your file directory, (e.g. /Users/JeffStrongman/.composer/vendor/bin), you’re good to go.
Where do I find composer bin in composer?
The Composer bin directory is set and stored in bin-dir config variable and can be different depending on your setup. Running the command composer global config bin-dir –absolute will tell you the absolute path to your global composer bin directory.
How to add a composer folder to bash?
This appends the folder to your existing PATH, however, it is only active for your current terminal session. If you want it to be automatically set, it depends on the shell you are using. For bash, you can append this line to $HOME/.bashrcusing your favorite editor or type the following on the shell