A simple CLI tool for Drupal.
composer require chi-teck/commander
vendor/bin/commander
- Create a command according to symfony/console documentation.
- Optionally, implement
Commander/DrupalAwareInterfaceto indicate that the command needs fully bootstrapped Drupal installation. - Register the command in composer.json.
"extra": {
"commands": ["Foo\\Command\\BarCommand"]
}
Command discovery is performed for all packages in vendor directory, enabled modules and themes.
Dependencies can be injected via factory create method. For modules it is possible to register a command as service like follows.
services:
Drupal\foo\Command\BarCommand:
arguments: ['@entity_type.manager']
#2242947: Integrate Symfony Console component to natively support command line operations
GNU General Public License, version 2 or later.