$npx -y skills add edutrul/drupal-ai --skill drupal-composerDrupal Composer management — requiring modules, updates, patches via composer-patches, and version constraints.
| 1 | # Drupal Composer Management |
| 2 | |
| 3 | ## Installing & Updating |
| 4 | |
| 5 | ```bash |
| 6 | composer require drupal/module_name |
| 7 | composer require drupal/module_name:^2.0 |
| 8 | composer require drupal/module_name:^1.0@dev |
| 9 | composer update drupal/module_name |
| 10 | composer update drupal/* |
| 11 | composer outdated drupal/* |
| 12 | composer audit |
| 13 | ``` |
| 14 | |
| 15 | ## Version Constraints |
| 16 | |
| 17 | | Constraint | Meaning | |
| 18 | |---|---| |
| 19 | | `^2.0` | >= 2.0.0 and < 3.0.0 | |
| 20 | | `~2.0` | >= 2.0.0 and < 2.1.0 | |
| 21 | | `2.x-dev` | Latest 2.x dev branch | |
| 22 | | `^1.0@dev` | >= 1.0 dev releases | |
| 23 | |
| 24 | ## Patches (composer-patches) |
| 25 | |
| 26 | ```json |
| 27 | "extra": { |
| 28 | "patches": { |
| 29 | "drupal/module_name": { |
| 30 | "Patch description - issue #1234567": "patches/module_name-patch-description.patch" |
| 31 | }, |
| 32 | "drupal/tb_megamenu": { |
| 33 | "Block content support": "patches/tb_megamenu-block-content-support.patch" |
| 34 | } |
| 35 | } |
| 36 | } |
| 37 | ``` |
| 38 | |
| 39 | Patches apply on `composer install` and re-apply on `composer update drupal/module_name`. |
| 40 | |
| 41 | ## Useful Commands |
| 42 | |
| 43 | ```bash |
| 44 | composer show drupal/module_name |
| 45 | composer validate |
| 46 | composer clear-cache |
| 47 | composer install --no-cache |
| 48 | ``` |