mj-zana / console
Console kernel on Symfony Console with a container scope per command for Zana applications
v2.37.0
2026-11-21 13:07 UTC
Requires
- php: ^8.5
- mj-zana/core: ^2.21
- symfony/console: ^7.4 || ^8.0
Requires (Dev)
- mj-zana/testing: ^2.6
- mj-zana/validation: ^2.10
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^11.5
Suggests
- ext-zip: Needed by release:build to write the upload archives
- mj-zana/testing: Lets the check command run the modules' architecture rules
- mj-zana/validation: To show the field errors of a ValidationException
Provides
None
Conflicts
None
Replaces
None
- dev-main
- v2.37.0
- v2.36.0
- v2.35.0
- v2.34.0
- v2.33.0
- v2.32.0
- v2.31.0
- v2.30.0
- v2.29.0
- v2.28.0
- v2.27.0
- v2.26.0
- v2.25.0
- v2.24.0
- v2.23.0
- v2.22.0
- v2.21.0
- v2.20.0
- v2.19.0
- v2.18.0
- v2.17.0
- v2.16.0
- v2.15.0
- v2.14.0
- v2.13.0
- v2.12.0
- v2.11.0
- v2.10.0
- v2.9.0
- v2.8.0
- v2.7.0
- v2.6.0
- v2.5.0
- v2.4.0
- v2.3.0
- v2.2.0
- v2.1.0
- v2.0.0
- v2.0.0-rc.1
- v2.0.0-beta.3
- v2.0.0-beta.2
- v2.0.0-beta.1
- v2.0.0-alpha.3
This package is auto-updated.
Last update: 2026-11-24 16:53:06 UTC
README
Console commands on Symfony Console, each run in its own container scope. Requires PHP 8.5 or later.
composer require mj-zana/console
Usage
// bin/zana $app = require __DIR__ . '/../bootstrap/app.php'; // with ConsoleServiceProvider exit(Zana\Console\ConsoleKernel::runApplication($app));
#[AsCommand(name: 'bmi:report', description: 'Print the BMI report of a patient')] final class BmiReportCommand extends Command { protected function configure(): void { $this->addArgument('patient', InputArgument::REQUIRED); } public function handle(InputInterface $input, SymfonyStyle $io, MeasurementRepository $measurements): int { $io->table(['Date', 'BMI'], $measurements->rowsFor($input->getArgument('patient'))); return self::SUCCESS; // or null } }
Register commands as services tagged console.commands:
$services->transient(BmiReportCommand::class)->tag(ConsoleKernel::TAG, BmiReportCommand::class);
- Scope: every run gets a fresh scope (
ScopeMetadata::cli('bmi:report')), disposed afterwards. handle()injection: the command's dependencies are injected, plus the current input, output and aSymfonyStyle, by type.- Plain Symfony commands work too.
Deployment commands
| Command | |
|---|---|
cache:clear, cache:warm |
The compiled container, the configuration cache, and tagged caches |
about |
The application, its environment and its Zana packages |
doctor |
Checks the server before going live, singletons included |
release:build |
Upload archives for shared hosting, from a commit (2.5). -v shows git and Composer, --timeout stops a stuck build |
License
MIT — see LICENSE.