<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/new-in-symfony-8-2-console-sub-commands-symfony-blog--1osa088as" -->

---
title: New in Symfony 8.2: Console sub-commands (Symfony Blog)
description: Symfony 8.2 introduces sub-commands to the Console component, letting developers run commands using space-separated names like 'tenant users import' instead of...
canonical: https://daily.dev/posts/new-in-symfony-8-2-console-sub-commands-symfony-blog--1osa088as
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: New in Symfony 8.2: Console sub-commands (Symfony Blog) | daily.dev
og:description: Symfony 8.2 introduces sub-commands to the Console component, letting developers run commands using space-separated names like 'tenant users import' instead of...
og:url: https://daily.dev/posts/new-in-symfony-8-2-console-sub-commands-symfony-blog--1osa088as
og:image: https://api.daily.dev/og/posts/1OsA088aS.png
og:image:alt: New in Symfony 8.2: Console sub-commands (Symfony Blog)
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# New in Symfony 8.2: Console sub-commands (Symfony Blog)

**[Symfony](https://daily.dev/sources/symfony)** · 6 min read · 4 upvotes · 0 comments

## Summary

Symfony 8.2 introduces sub-commands to the Console component, letting developers run commands using space-separated names like 'tenant users import' instead of only colon-separated ones like 'tenant:users:import', mirroring the style used by Docker and Git. Each level in the tree can parse its own options, and sub-commands take precedence over parent argument values (use '--' to disambiguate). A new CommandChain object lets sub-commands read the resolved input of their parent commands. The #[AsCommand] attribute is extended so entire command trees, including group-level options, can be defined within a single class, and ArrayInput/ApplicationTester now support positional values for testing spaced invocations.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://symfony.com/blog/new-in-symfony-8-2-console-sub-commands>

## Questions this post answers

### How do I create console sub-commands with spaces in Symfony 8.2, like Docker's 'docker compose up' style?

Symfony 8.2 automatically builds a command tree from colon-separated command names, so a command registered as 'tenant:users:import' can also be run as 'tenant users import'. Each level parses its own options independently, and running 'php bin/console tenant users import customers.csv --dry-run' executes the same command as the colon form. No extra configuration is needed for existing namespaced commands like 'cache:clear', which already work as 'cache clear'.

_Developers adopting Symfony 8.2's console changes can track PHP release details on daily.dev._

### How do I access a parent command's options from a Symfony 8.2 sub-command?

Inject the CommandChain service into the sub-command and call getInput() with the parent command's name or class, then call getOption() on the result, for example $chain->getInput('tenant')?->getOption('name'). The parent is only present in the chain when the command is invoked using the spaced form; running the colon-separated name directly makes getInput() return null, which is why the nullsafe operator is used.

_Teams building multi-level Symfony CLI apps can follow console API changes like this on daily.dev._

### In Symfony 8.2, what happens if a command argument has the same name as one of its sub-commands, like 'deploy rollback'?

Sub-commands always take precedence over arguments with matching names, so 'php bin/console deploy rollback' runs the 'deploy:rollback' sub-command rather than passing 'rollback' as the 'deploy' command's target argument. This is a behavior change from before Symfony 8.2, where 'rollback' would have been treated as the argument value. To force the argument interpretation, prepend '--', as in 'php bin/console deploy -- rollback'.

_Developers upgrading Symfony console apps can watch for behavior changes like this on daily.dev._

## Similar posts on daily.dev

- [New in Symfony 8.1: Improved Console Input \(Symfony Blog\)](https://daily.dev/posts/new-in-symfony-8-1-improved-console-input-symfony-blog--igo6t3l80) · Symfony · 5 upvotes · 0 comments
- [New in Symfony 8.1: Console Argument Resolvers \(Symfony Blog\)](https://daily.dev/posts/new-in-symfony-8-1-console-argument-resolvers-symfony-blog--eznftkcgj) · Symfony · 0 upvotes · 0 comments
- [New in Symfony 8.1: Console Progress and Testing Improvements \(Symfony Blog\)](https://daily.dev/posts/new-in-symfony-8-1-console-progress-and-testing-improvements-symfony-blog--ehdamvued) · Symfony · 1 upvotes · 0 comments
- [Symfony 8.1 curated new features \(Symfony Blog\)](https://daily.dev/posts/symfony-8-1-curated-new-features-symfony-blog--9qonflcdy) · Symfony · 4 upvotes · 0 comments

---

Tags: [#php](https://daily.dev/tags/php), [#symfony](https://daily.dev/tags/symfony)

[View this post on daily.dev](https://daily.dev/posts/new-in-symfony-8-2-console-sub-commands-symfony-blog--1osa088as)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"New in Symfony 8.2: Console sub-commands (Symfony Blog)","url":"https://daily.dev/posts/new-in-symfony-8-2-console-sub-commands-symfony-blog--1osa088as","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/new-in-symfony-8-2-console-sub-commands-symfony-blog--1osa088as"},"datePublished":"2026-09-16T07:53:14.571Z","dateModified":"2026-09-16T07:53:36.798Z","description":"Symfony 8.2 introduces sub-commands to the Console component, letting developers run commands using space-separated names like 'tenant users import' instead of...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/327b244859fddae8f3a20d0225898aa0?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/327b244859fddae8f3a20d0225898aa0?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Symfony","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Symfony","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/cc07051b7112472f9729e73c14660a64","url":"https://daily.dev/sources/symfony"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/new-in-symfony-8-2-console-sub-commands-symfony-blog--1osa088as","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":4},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"php,symfony","timeRequired":"PT6M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Symfony","item":"https://daily.dev/sources/symfony"},{"@type":"ListItem","position":3,"name":"New in Symfony 8.2: Console sub-commands (Symfony Blog)"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/new-in-symfony-8-2-console-sub-commands-symfony-blog--1osa088as#faq","mainEntity":[{"@type":"Question","name":"How do I create console sub-commands with spaces in Symfony 8.2, like Docker's 'docker compose up' style?","acceptedAnswer":{"@type":"Answer","text":"Symfony 8.2 automatically builds a command tree from colon-separated command names, so a command registered as 'tenant:users:import' can also be run as 'tenant users import'. Each level parses its own options independently, and running 'php bin/console tenant users import customers.csv --dry-run' executes the same command as the colon form. No extra configuration is needed for existing namespaced commands like 'cache:clear', which already work as 'cache clear'. Developers adopting Symfony 8.2's console changes can track PHP release details on daily.dev."}},{"@type":"Question","name":"How do I access a parent command's options from a Symfony 8.2 sub-command?","acceptedAnswer":{"@type":"Answer","text":"Inject the CommandChain service into the sub-command and call getInput() with the parent command's name or class, then call getOption() on the result, for example $chain-\u003egetInput('tenant')?-\u003egetOption('name'). The parent is only present in the chain when the command is invoked using the spaced form; running the colon-separated name directly makes getInput() return null, which is why the nullsafe operator is used. Teams building multi-level Symfony CLI apps can follow console API changes like this on daily.dev."}},{"@type":"Question","name":"In Symfony 8.2, what happens if a command argument has the same name as one of its sub-commands, like 'deploy rollback'?","acceptedAnswer":{"@type":"Answer","text":"Sub-commands always take precedence over arguments with matching names, so 'php bin/console deploy rollback' runs the 'deploy:rollback' sub-command rather than passing 'rollback' as the 'deploy' command's target argument. This is a behavior change from before Symfony 8.2, where 'rollback' would have been treated as the argument value. To force the argument interpretation, prepend '--', as in 'php bin/console deploy -- rollback'. Developers upgrading Symfony console apps can watch for behavior changes like this on daily.dev."}}]}
```

