Download the PHP package phpdot/console without Composer
On this page you can find all versions of the php package phpdot/console. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package console
phpdot/console
CLI application framework wrapping symfony/console — DI integration, attribute-driven command discovery, and output helpers. Standalone.
Table of Contents
- Requirements
- Installation
- Usage
- Discovery
- Architecture
- Testing
- License
Requirements
| Requirement | Constraint |
|---|---|
| PHP | >= 8.5 |
symfony/console |
^8.0 |
psr/container |
^2.0 |
phpdot/attribute |
^0.5 |
phpdot/container is a dev-only suggestion — it exposes #[Config('console')] to a phpdot
framework boot. Standalone consumers do not need it; the attribute is inert until reflected.
ext-swoole is suggested — the coroutine-aware helpers in Command activate when it is loaded.
Installation
Usage
Standalone
With discovery
cachePath makes Application build its own CommandCache automatically. Pass an explicit CommandCache instance via the third constructor argument when you need a custom one.
With DI container
Auto-binding via phpdot/config
ConsoleConfig carries #[Config('console')], so phpdot/config hydrates it from config/console.php:
A future console provider will resolve the DTO from Configuration::dto() and inject it into Application automatically. Until then, construct the DTO yourself.
Modifying discovered commands
Apps frequently want to alias, rename, or relabel commands shipped by other packages — for shortcuts, brand consistency, or collision resolution. Three methods on Application:
Rules:
alias()is additive — never breaks the original name. Throws if the new name is already taken by a different command.rename()replaces the name. Throws if the new name is already taken.override()mutates non-name metadata only (description, help). Userename()for the name.- All three are chainable.
Defining commands
Output helpers
Table
Progress
Interactive input
Programmatic execution
Discovery
CommandDiscovery scans directories for classes with #[AsCommand] that extend Symfony\Component\Console\Command\Command. Class discovery is delegated to phpdot/attribute, which handles tokenization, namespace resolution, and attribute reading.
Skips: interfaces, traits, enums, abstract classes, classes without #[AsCommand], and classes that don't extend Symfony's Command.
Cache format
Architecture
Testing
The package is standalone-testable:
License
MIT.
This repository is a read-only mirror, generated by CI from phpdot/monorepo. Pull requests and issues belong in the monorepo.
All versions of console with dependencies
phpdot/attribute Version ^0.6
psr/container Version ^2.0
symfony/console Version ^8.0