chi-teck/commander

Simple and fast CLI tool for Drupal

dev-master 2019-07-30 18:26 UTC

This package is auto-updated.

Last update: 2020-06-30 01:21:33 UTC


README

A simple CLI tool for Drupal.

Installation

composer require chi-teck/commander

Usage

vendor/bin/commander

Command Authoring

  1. Create a command according to symfony/console documentation.
  2. Optionally, implement Commander/DrupalAwareInterface to indicate that the command needs fully bootstrapped Drupal installation.
  3. 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']

Links

#2242947: Integrate Symfony Console component to natively support command line operations

License

GNU General Public License, version 2 or later.