Console commands (CLI)

It is possible to run TYPO3 scripts from the command line. This functionality can be used to set up cron jobs, for example.

TYPO3 uses Symfony commands API for writing CLI (command line interface) commands. These commands can also be run from the TYPO3 scheduler if this option is not disabled in the Configuration/Services.yaml.

The starting point for the commands differs depending on the type of your TYPO3 installation.

  • For installations with Composer, the starting point is the project folder, which also contains the composer.json file of the project. The CLI commands usually start with vendor/bin/typo3.
  • For legacy installations (without Composer), the starting point is usually the web root, so CLI commands start with typo3/sysext/core/bin/typo3.

Run a command from the command line

You can list the available commands by calling:

vendor/bin/typo3
Copied!
typo3/sysext/core/bin/typo3
Copied!

For example, you can clear all caches by calling:

vendor/bin/typo3 cache:flush
Copied!
typo3/sysext/core/bin/typo3 cache:flush
Copied!

Show help for the command:

vendor/bin/typo3 cache:flush -h
Copied!
typo3/sysext/core/bin/typo3 cache:flush -h
Copied!

Running the command from the scheduler

By default, it is possible to run a command from the TYPO3 scheduler as well. To do this, select the task Execute console commands followed by your command in the Schedulable Command field.

In order to prevent commands from being set up as scheduler tasks, see 1. Register the command.

Create a custom command

See the Tutorial: Create a console command for details on how to create commands.

DataHandler usage

Using the DataHandler in a CLI command requires backend authentication. See Using the DataHandler in a Symfony command for more information.

Read more