CLI Banner Icon

CLI Banner 

The classic "wrong SSH terminal" scenario is the CLI counterpart to the original motivation of this extension: running an import, a custom deployment command or impexp:import on the live system instead of staging. The CLI banner prints an environment banner with a colored background to stderr before a console command runs, e.g. a cyan bar reading 🚦 STAGING — project.example.dev.

CLI banner

CLI banner

The banner is printed via a listener on the Symfony Console ConsoleCommandEvent , so it appears before the command is executed. It is written to stderr, so parsed stdout output (JSON, CSV) stays untouched.

You can register the indicator in your ext_localconf.php:

ext_localconf.php
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Handler;
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Indicator;
use KonradMichalik\Typo3EnvironmentIndicator\Configuration\Trigger;

Handler::addIndicator(
    triggers: [
        new Trigger\ApplicationContext('Production/Staging')
    ],
    indicators: [
        new Indicator\Cli\Banner([
            'text' => 'STAGING',
            'color' => 'cyan',
        ])
    ]
);
Copied!

Additional optional configuration keys:

  • text (string): The banner text. Default is the current application context.
  • color (string): The banner background color. Accepts a named ANSI color (e.g. cyan, red, yellow) or a hex value (e.g. #00ACC1, rendered on truecolor terminals) and is combined with bold white text. Default is no color (plain text, no background).
  • icon (string): A leading glyph. Default is 🚦.
  • commands (array): A whitelist of command name patterns (fnmatch syntax, e.g. ['site:*', 'impexp:*']). If set, the banner is only printed for matching commands. Default is empty (the banner is printed for all commands).

The CLI banner is opt-in and disabled by default — enable it globally via the extension configuration.