Below are some common composer commands
Install Theme
1
| composer require 'drupal/bootstrap5:^4.0'
|
Install Drush module
The below use of composer is also using ddev
. If not using Ddev exclude the ddev
from the command.
1
| ddev composer require --dev drush/drush
|
Update Drupal Core
Update to 10.3
1
| composer require drupal/core-recommended:10.3 drupal/core-composer-scaffold:10.3 drupal/core-project-message:10.3 --update-with-all-dependencies
|
Update to 10.2
1
| composer require drupal/core-recommended:10.2 drupal/core-composer-scaffold:10.2 drupal/core-project-message:10.2 --update-with-all-dependencies
|
How to install a sub theme in Drupal using composer
In this example we install the radix theme as a sub theme in Drupal using composer
1
| composer require drupal/radix
|
Install components module
1
| composer require 'drupal/components:^3.0@beta'
|
Enable components
Now create a sub theme
1
| drush --include="themes/contrib/radix" radix:create radix_blocks
|
Enable the Sub theme
- Go to appearence and themes
- Install and set as default the radix subtheme
Troubleshooting
Below are fixes to some errors i have needed to fix at times.
Fix the Satisfy Requirement Error
For example:
1
| phpunit/phpunit 5.7.16 requires php ^5.6 || ^7.0 -> your php version (8.1.29) does not satisfy that requirement
|
- open
composer.json
- update
"phpunit/phpunit": "5.7.16|6.*"
to a Satifiable version "phpunit/phpunit": "^9.5"