---
title: "Important: #101567 - Use Symfony attribute to autoconfigure cli commands"
manual: "TYPO3 Core Changelog"
version: "main"
permalink: "https://docs.typo3.org/permalink/changelog:important-101567-1691227840"
source: "Changelog/12.4.x/Important-101567-UseSymfonyAttributeToAutoconfigureCliCommands.rst"
typo3-version: "12.4.x"
typo3-major: 12
type: "important"
issue: 101567
forge: "https://forge.typo3.org/issues/101567"
tags: ["Backend", "CLI", "PHP-API", "ext:core"]
rendered: "2026-10-03T08:19:36+00:00"
---

# Important: #101567 - Use Symfony attribute to autoconfigure cli commands {#important-101567-1691227840}

See [forge#101567](https://forge.typo3.org/issues/101567)

## Description {#description}

The Symfony PHP attribute `\Symfony\Component\Console\Attribute\AsCommand`
is now accepted to register console commands.
This way CLI commands can be registered by setting the attribute on the command
class. Only the parameters `command`, `description`, `aliases` and `hidden` are
still viable. In order to overwrite the schedulable parameter use the old
`Services.yaml` way to register console commands. By default `schedulable`
is true.

Before:

**EXT:my_extension/Configuration/Services.yaml**

```yaml
MyVendor\MyExtension\Command\MyCommand:
  tags:
    - name: 'console.command'
      command: 'myprefix:dofoo'
      description: 'My description'
      schedulable: true
    - name: 'console.command'
      command: 'myprefix:dofoo-alias'
      alias: true
```

After:

The registration can be removed from the `Services.yaml` file and the
attribute is assigned to the command class instead:

**EXT:my_extension/Classes/Command/MyCommand.php**

```php
<?php

namespace MyVendor\MyExtension\Command;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Attribute\AsCommand;

#[AsCommand(
    name: 'myprefix:dofoo',
    description: 'My description',
    aliases: ['myprefix:dofoo-alias']
)]
class MyCommand extends Command
{
}
```

## Impact {#impact}

The registration of cli commands is simplified that way.
When using this attribute there is no need to register the command in the
`Services.yaml` file. Existing configurations work as before.
