How symfony/console works
Symfony Console is a PHP component for building command-line applications. A user supplies command-line input; the application selects and runs a command, which consumes parsed arguments and options and writes formatted output. The component also provides interactive questions and styles, shell completion, command descriptions, service-container integration, event and signal handling, and Messenger-based command execution. Edges are limited to relationships shown in excerpts, SOURCE INDEX references, or the README; unsampled subsystem wiring is not inferred.
Main entry points: Command.php Command · Application.php Application · InputDefinition.php Input definition · Output.php Output
Components 22
Command execution
- Application
Application.php - Command
Command/Command.php - Argument resolver
ArgumentResolver/ArgumentResolver.php
Input and output
- CLI input
Input/ArgvInput.php - Input state
Input/Input.php - Input definition
Input/InputDefinition.php - Argument spec
Input/InputArgument.php - Option spec
Input/InputOption.php - Output
Output/Output.php - Output formatter
Formatter/OutputFormatter.php
Interactive features
- Questions
Question/Question.php - Console styles
Style/SymfonyStyle.php - Completion input
Completion/CompletionInput.php - Completion suggestions
Completion/CompletionSuggestions.php - Completion commands
Command/CompleteCommand.php
Framework integration
- Command loader
CommandLoader/ContainerCommandLoader.php - Command registration
DependencyInjection/AddConsoleCommandPass.php - Console events
Event/ConsoleCommandEvent.php - Messenger handler
Messenger/RunCommandMessageHandler.php
Inspection and help
- Text descriptor
Descriptor/TextDescriptor.php - Help command
Command/HelpCommand.php
Other components
- CLI user
Connections 27
- CLI user → CLI input: provides tokens
- Application → CLI input: parses input
Application.php - Application → Command: runs command
Application.php - Application → Command loader: loads commands
Application.php - Application → Completion commands: routes completion
Application.php - Application → Console events: dispatches events
Application.php - Command → Input definition: configures inputs
Command/Command.php - Command → Input state: receives input
Command/Command.php - Command → Output: writes output
Command/Command.php - Input state → Input definition: binds against
Input/Input.php - Input definition → Argument spec: stores arguments
Input/InputDefinition.php - Input definition → Option spec: stores options
Input/InputDefinition.php - Output → Output formatter: formats messages
Output/Output.php - Output formatter → Output: formats writes
Output/Output.php - Argument resolver → Command: resolves parameters
ArgumentResolver/ArgumentResolver.php - Argument resolver → Input state: reads values
ArgumentResolver/ArgumentResolver.php - Completion commands → Completion input: parses completion
- Completion input → Input definition: reads specifications
Completion/CompletionInput.php - Completion input → Option spec: checks options
Completion/CompletionInput.php - Command → Completion suggestions: offers suggestions
Command/Command.php - Command registration → Command loader: registers commands
DependencyInjection/AddConsoleCommandPass.php - Messenger handler → Application: runs application
Messenger/RunCommandMessageHandler.php - Messenger handler → Command: selects command
Messenger/RunCommandMessageHandler.php - Text descriptor → Command: describes commands
Descriptor/TextDescriptor.php - Text descriptor → Output: writes description
Descriptor/TextDescriptor.php - Application → Help command: selects help
Application.php - Console styles → Questions: supports prompts
Style/SymfonyStyle.php