PHPackages                             phpnomad/console - 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/console

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

phpnomad/console
================

1.0.0(1y ago)03.7k4MITPHP

Since Apr 14Pushed 2mo ago1 watchersCompare

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

READMEChangelog (1)Dependencies (1)Versions (2)Used By (4)

phpnomad/console
================

[](#phpnomadconsole)

[![Latest Version](https://camo.githubusercontent.com/202b87fdb66f3ccd97c84610eb752b45e5afee4bc1e77c6f076bd41846de7c28/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7068706e6f6d61642f636f6e736f6c652e737667)](https://packagist.org/packages/phpnomad/console)[![Total Downloads](https://camo.githubusercontent.com/99f542a0387b63fb4986675481556a7304a4f4ec0ab782c83affa3472655bd77/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7068706e6f6d61642f636f6e736f6c652e737667)](https://packagist.org/packages/phpnomad/console)[![PHP Version](https://camo.githubusercontent.com/8516790332afd83bc9522eb3e579e2fed3f19ec9fce349404ade3e123e6a698a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7068706e6f6d61642f636f6e736f6c652e737667)](https://packagist.org/packages/phpnomad/console)[![License](https://camo.githubusercontent.com/6013da908d2eec22fe0095249c609b1186d8c5522414667c8455a5a284dde7ff/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7068706e6f6d61642f636f6e736f6c652e737667)](https://packagist.org/packages/phpnomad/console)

`phpnomad/console` defines the contracts PHPNomad applications use to describe CLI commands without binding to a specific console runtime. It ships the `Command`, `Input`, `OutputStrategy`, and `ConsoleStrategy` interfaces along with a declarative signature format for parameters and options. The package has no runtime dependencies of its own. Concrete execution comes from an integration such as [`phpnomad/symfony-console-integration`](https://packagist.org/packages/phpnomad/symfony-console-integration), which adapts the contracts to Symfony Console. You describe your commands once, and the host runtime parses input, maps arguments, and calls your handler.

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

[](#installation)

```
composer require phpnomad/console
```

You will also need a `ConsoleStrategy` implementation. For most projects that means pairing this package with `phpnomad/symfony-console-integration`.

Overview
--------

[](#overview)

- `Command` declares a CLI command with a signature, description, and `handle(Input): int` method.
- The signature format is declarative. Required positionals look like `{name}`, optional positionals like `{name?:Description}`, flags like `{--force}`, and named options like `{--count=1:Number of items}`.
- `Input` exposes parsed parameters through `getParam`, `hasParam`, `setParam`, and `getParams`.
- `OutputStrategy` provides chainable writers for `writeln`, `info`, `success`, `warning`, `error`, `newline`, and `table` rendering.
- `HasCommands` lets an initializer expose a list of command class strings so the loader can register them with the active `ConsoleStrategy`.
- `Middleware` and `Interceptor` interfaces hook pre-execution transforms and post-execution side effects like logging or event dispatch.

Quick example
-------------

[](#quick-example)

A command implements three methods. An initializer lists the classes it owns.

```
