.. include:: /Includes.rst.txt .. _command_controllers: =================== Command Controllers =================== .. note:: Since TYPO3 8, it is possible to use Symfony commands in TYPO3. This is the preferred method and is documented in "TYPO3 Explained" :ref:`t3coreapi:cli-mode-command-controllers`. You can still use Extbase Command Controllers, but they have been `deprecated in 9.4 `__ and will trigger a PHP :php:`E_USER_DEPRECATED` error if used from the command line. Command controllers make functionality available at the command line and in the scheduler backend module. They can provide functionality for recurring tasks like mail queues, cleanups, imports and more, which is then available for administrators and regular backend users. .. _extbase_command_controller_creating: Creating command controllers ---------------------------- A `CommandController` needs to be located at :file:`Classes/Command/`. This following simple example meets the minimum requirements. :file:`Classes/Command/SimpleCommandController.php`:: ] ARGUMENTS: --required OPTIONS: --optional .. _extbase_command_controller_documentation: Command documentation --------------------- So far you have provided information on what the command and its arguments. To help others, you may want to provide further information within the PHPDoc that is to be displayed on the commandline:: /** * This is a short description. * * This will be further information available to everyone asking for it * from the cli. * * @param int $required This is an required argument. * @param bool $optional And this is an optional argument. */ public function argumentsCommand($required, $optional = false) { } The information is shown when calling `typo3/cli_dispatch.phpsh extbase help simple:arguments`: .. code-block:: none This is a short description. COMMAND: example:simple:arguments USAGE: /typo3/cli_dispatch.phpsh typo3/cli_dispatch.phpsh extbase simple:arguments [] ARGUMENTS: --required This is an required argument. OPTIONS: --optional And this is an optional argument. DESCRIPTION: This will be further information available to everyone asking for it from the cli.