- 779 views
Do not forget, that you need to have Composer installed in your Drupal installation from the beginning. Use the following command to install Drupal 8 with Composer.
$ composer create-project drupal-composer/drupal-project:8.x-dev some-dir --stability dev --no-interact
You can easily follow steps in this tutorial as well:
Do not forget, that you have to have Composer installed in your operating system in order to make things work properly.
Assuming you have already installed Drupal and used Composer to install new modules, you just need to add those lines to your composer.json file located in Drupal root directory.
"extra": { "drupal-scaffold": { "locations": { "web-root": "./" } }, "installer-paths": { "core": ["type:drupal-core"], "libraries/{$name}": ["type:drupal-library"], "modules/contrib/{$name}": ["type:drupal-module"], "profiles/contrib/{$name}": ["type:drupal-profile"], "themes/contrib/{$name}": ["type:drupal-theme"], "drush/Commands/contrib/{$name}": ["type:drupal-drush"], "modules/custom/{$name}": ["type:drupal-custom-module"], "themes/custom/{$name}": ["type:drupal-custom-theme"] }, "drupal-core-project-message": { "include-keys": ["homepage", "support"], "post-create-project-cmd-message": [ "<bg=blue;fg=white> </>", "<bg=blue;fg=white> Congratulations, you’ve installed the Drupal codebase </>", "<bg=blue;fg=white> from the drupal/legacy-project template! </>", "<bg=blue;fg=white> </>", "", "<bg=yellow;fg=black>Next steps</>:", " * Install the site: https://www.drupal.org/docs/8/install", " * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html", " * Get support: https://www.drupal.org/support", " * Get involved with the Drupal community:", " https://www.drupal.org/getting-involved", " * Remove the plugin that prints this message:", " composer remove drupal/core-project-message" ] }, "patches": { "drupal/views_fieldsets": { "Drupal Views Fieldsets patch": "https://www.drupal.org/files/issues/2018-05-30/views_fieldsets-fix_empty_handler_query-2908454-56.patch" } }
Please notice the last section "patches", where you can easily put as many patches as needed.
If you happen to struggle with installing patches, try to run this command:
composer require 'cweagans/composer-patches'
Which should allow you to install patches afterwards. This might come handy if your Drupal was not installed by composer in the first place but you want to "composerize" your Drupal installation afterwards.