PHPackages                             ez-php/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. ez-php/console

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

ez-php/console
==============

Lightweight console infrastructure for PHP — command dispatcher, argument parser, and colored output helpers

1.11.1(1mo ago)04.0k↓90%4MITPHPPHP ^8.5CI passing

Since Mar 14Pushed 1mo agoCompare

[ Source](https://github.com/ez-php/console)[ Packagist](https://packagist.org/packages/ez-php/console)[ Docs](https://github.com/ez-php/console)[ RSS](/packages/ez-php-console/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (14)Versions (44)Used By (4)

ez-php/console
==============

[](#ez-phpconsole)

Lightweight console infrastructure for PHP — command dispatcher, argument parser, and colored output helpers.

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

[](#installation)

```
composer require ez-php/console
```

Usage
-----

[](#usage)

### Defining a command

[](#defining-a-command)

```
use EzPhp\Console\CommandInterface;
use EzPhp\Console\Input;
use EzPhp\Console\Output;

class GreetCommand implements CommandInterface
{
    public function getName(): string { return 'greet'; }
    public function getDescription(): string { return 'Greet someone'; }
    public function getHelp(): string { return 'Usage: ez greet '; }

    public function handle(array $args): int
    {
        $input = new Input($args);
        $name = $input->argument(0) ?? 'World';
        Output::success("Hello, $name!");
        return 0;
    }
}
```

### Running the console

[](#running-the-console)

```
use EzPhp\Console\Console;

$console = new Console([new GreetCommand()]);
exit($console->run($argv));
```

### Output helpers

[](#output-helpers)

```
Output::line('plain text');
Output::info('informational message');   // blue
Output::success('it worked!');           // green
Output::warning('be careful');           // yellow
Output::error('something failed');       // red (stderr)
Output::colorize('custom', 35);          // magenta
```

### Parsing arguments

[](#parsing-arguments)

```
$input = new Input(['foo', '--name=Alice', '--verbose']);

$input->argument(0);          // 'foo'
$input->option('name');       // 'Alice'
$input->option('missing', 'default'); // 'default'
$input->hasFlag('verbose');   // true
```

Progress bars
-------------

[](#progress-bars)

```
$bar = Output::progressBar(100);
foreach ($items as $item) {
    process($item);
    $bar->advance();
}
$bar->finish();
```

Interactive prompts
-------------------

[](#interactive-prompts)

```
use EzPhp\Console\Prompt;

$prompt = new Prompt();
$name   = $prompt->ask('What is your name?');
$ok     = $prompt->confirm('Continue?');
$color  = $prompt->choice('Pick a color', ['red', 'green', 'blue']);
```

Structured command definitions
------------------------------

[](#structured-command-definitions)

Commands implementing `HasDefinition` expose typed argument and option metadata for `--help` rendering:

```
use EzPhp\Console\HasDefinition;
use EzPhp\Console\CommandDefinition;

class MyCommand implements CommandInterface, HasDefinition
{
    public function getDefinition(): CommandDefinition
    {
        return (new CommandDefinition())
            ->argument('name', 'The user name')
            ->option('force', 'f', 'Skip confirmation');
    }
    // ...
}
```

Command aliases
---------------

[](#command-aliases)

```
use EzPhp\Console\AliasedCommand;

$commands = [
    new AliasedCommand($app->make(MigrateCommand::class), 'db:migrate'),
];
```

Classes
-------

[](#classes)

ClassDescription`Console`Command registry and dispatcher`CommandInterface`Contract: `getName`, `getDescription`, `getHelp`, `handle``HasDefinition`Optional interface: exposes `CommandDefinition` for structured `--help``AliasedCommand`Wraps a command under a different name`Input`Parses argv tokens into positional arguments and named options/flags`Output`Static ANSI output helpers; `table()`; `progressBar()` factory`ProgressBar`In-place terminal progress bar`Prompt`Interactive prompts: `ask()`, `confirm()`, `choice()``InputStreamInterface`Abstraction over a readable line stream (injectable for testing)`StdinInputStream``InputStreamInterface` implementation reading from STDIN`CommandDefinition`Fluent builder for argument + option declarations`ArgumentDefinition`Value object: positional argument (name, description, required)`OptionDefinition`Value object: named option (name, short alias, description)License
-------

[](#license)

MIT

###  Health Score

51

—

FairBetter than 95% of packages

Maintenance91

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 91% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

43

Last Release

43d ago

Major Versions

0.9.3 → 1.0.02026-03-24

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/122030400?v=4)[AU9500](/maintainers/AU9500)[@AU9500](https://github.com/AU9500)

---

Top Contributors

[![AU9500](https://avatars.githubusercontent.com/u/122030400?v=4)](https://github.com/AU9500 "AU9500 (121 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (12 commits)")

---

Tags

phpcliconsoleterminalcommand

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ez-php-console/health.svg)

```
[![Health](https://phpackages.com/badges/ez-php-console/health.svg)](https://phpackages.com/packages/ez-php-console)
```

###  Alternatives

[league/climate

PHP's best friend for the terminal. CLImate allows you to easily output colored text, special formats, and more.

1.9k14.5M291](/packages/league-climate)[aplus/cli

Aplus Framework CLI Library

2311.7M6](/packages/aplus-cli)[php-school/learn-you-php

An introduction to PHP's core features: i/o, http, arrays, exceptions and so on.

3202.0k](/packages/php-school-learn-you-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
