PHPackages                             phpnomad/symfony-console-integration - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. phpnomad/symfony-console-integration

ActiveLibrary[CLI &amp; Console](/categories/cli)

phpnomad/symfony-console-integration
====================================

1.0.4(2mo ago)0822MITPHPCI passing

Since Apr 16Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/phpnomad/symfony-console-integration)[ Packagist](https://packagist.org/packages/phpnomad/symfony-console-integration)[ Docs](https://github.com/phoenix/core)[ RSS](/packages/phpnomad-symfony-console-integration/feed)WikiDiscussions main Synced today

READMEChangelog (5)Dependencies (15)Versions (7)Used By (2)

phpnomad/symfony-console-integration
====================================

[](#phpnomadsymfony-console-integration)

[![Latest Version](https://camo.githubusercontent.com/770b2b2a7724679e5f0a3aaee26f922554fc27261c4092b068fcf77f2ef021ed/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7068706e6f6d61642f73796d666f6e792d636f6e736f6c652d696e746567726174696f6e2e737667)](https://packagist.org/packages/phpnomad/symfony-console-integration)[![Total Downloads](https://camo.githubusercontent.com/34859c38c3707338af125f3d269228df61390cec2ec02cd4b759a5388d0e9804/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7068706e6f6d61642f73796d666f6e792d636f6e736f6c652d696e746567726174696f6e2e737667)](https://packagist.org/packages/phpnomad/symfony-console-integration)[![PHP Version](https://camo.githubusercontent.com/26333fd963accff5ba8ccca3c410fb4be219cdb7f95fc5f792e09d3731e5ac21/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7068706e6f6d61642f73796d666f6e792d636f6e736f6c652d696e746567726174696f6e2e737667)](https://packagist.org/packages/phpnomad/symfony-console-integration)[![License](https://camo.githubusercontent.com/585109ca64550fa5c99c59247ac8782ac7094b29537fd5d94adde54e2d65dea1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7068706e6f6d61642f73796d666f6e792d636f6e736f6c652d696e746567726174696f6e2e737667)](https://packagist.org/packages/phpnomad/symfony-console-integration)

Integrates [Symfony Console](https://symfony.com/doc/current/components/console.html) with PHPNomad's console abstraction. Your commands implement `phpnomad/console`'s `Command` interface and declare their arguments through PHPNomad's signature syntax. This package parses those signatures, registers the commands with a Symfony `Application`, and runs `handle()` through any declared middleware and interceptors. Your command classes never reference Symfony directly.

Installation
------------

[](#installation)

```
composer require phpnomad/symfony-console-integration
```

What This Provides
------------------

[](#what-this-provides)

- `ConsoleStrategy` parses a PHPNomad signature into Symfony `InputArgument` and `InputOption` definitions, wraps the command in an anonymous Symfony `Command` subclass, and runs `handle()` through any `HasMiddleware` and `HasInterceptors` hooks. `ConsoleException` failures are logged via `LoggerStrategy` and surfaced through `OutputStrategy::error()` with exit code 1.
- `ConsoleOutputStrategy` maps `writeln`, `info`, `success`, `warning`, `error`, `newline`, and `table` onto a Symfony `OutputInterface` with blue, green, yellow, and red formatter styles.
- `Input` wraps a Symfony `InputInterface` behind PHPNomad's `Input` contract, with an override map so middleware can mutate values without touching the Symfony request.
- `Initializer` is a `phpnomad/loader` initializer that binds the strategies to their PHPNomad interfaces and provides a singleton Symfony `OutputInterface` (a `ConsoleOutput` with the default formatter).

Requirements
------------

[](#requirements)

- `phpnomad/console`, the contract this package implements
- `symfony/console` ^7.2, the library this package bridges
- `phpnomad/logger` for exception logging inside the command wrapper
- `phpnomad/utils` and `phpnomad/loader` for bootstrapping

Usage
-----

[](#usage)

Bind a Symfony `Application` into your container, pass this package's `Initializer` to your `Bootstrapper` alongside any initializer that declares commands via `HasCommands`, then call `run()` on the resolved `ConsoleStrategy`:

```
