class StatusCommand

Same name and namespace in other branches
  1. 11.x core/modules/system/src/Command/StatusCommand.php \Drupal\system\Command\StatusCommand

Prints status information about the site.

@internal

Attributes

#[AsCommand(name: 'system:status', description: 'Show system status.', aliases: [ 'status', ])]

Hierarchy

Expanded class hierarchy of StatusCommand

1 file declares its use of StatusCommand
StatusCommandTest.php in core/modules/system/tests/src/Kernel/Command/StatusCommandTest.php

File

core/modules/system/src/Command/StatusCommand.php, line 22

Namespace

Drupal\system\Command
View source
class StatusCommand {
  use StringTranslationTrait;
  public function __construct(protected ConfigFactoryInterface $config) {
  }
  
  /**
   * Show system status.
   */
  public function __invoke(InputInterface $input, OutputInterface $output) : int {
    $io = new SymfonyStyle($input, $output);
    $rows = [
      [
        (string) $this->t('Drupal version') => ': ' . \Drupal::VERSION,
      ],
      [
        (string) $this->t('Site URL') => ': ' . Url::fromRoute('<front>')->setAbsolute()
          ->toString(),
      ],
      [
        (string) $this->t('PHP binary') => ': ' . Path::canonicalize(PHP_BINARY),
      ],
      [
        (string) $this->t('PHP version') => ': ' . PHP_VERSION,
      ],
      [
        (string) $this->t('PHP OS') => ': ' . PHP_OS,
      ],
      [
        (string) $this->t('Default theme') => ': ' . $this->config
          ->get('system.theme')
          ->get('default'),
      ],
      [
        (string) $this->t('Admin theme') => ': ' . $this->config
          ->get('system.theme')
          ->get('admin'),
      ],
    ];
    $io->definitionList(...$rows);
    return Command::SUCCESS;
  }

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.