PHPackages                             waffle-commons/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. waffle-commons/console

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

waffle-commons/console
======================

Console component for Waffle framework.

0.1.0-beta5(2w ago)1181MITPHPPHP ^8.5CI passing

Since May 16Pushed 2w agoCompare

[ Source](https://github.com/waffle-commons/console)[ Packagist](https://packagist.org/packages/waffle-commons/console)[ RSS](/packages/waffle-commons-console/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (7)Dependencies (21)Versions (9)Used By (1)

[![Discord](https://camo.githubusercontent.com/b30f41baece56d71f7f496f7e39fd33a2a096221c66c648b350dd4fe14276c2e/68747470733a2f2f696d672e736869656c64732e696f2f646973636f72642f3735353238383030313539323033333339313f6c6f676f3d646973636f7264)](https://discord.gg/eKgywnfXr2)[![PHP Version Require](https://camo.githubusercontent.com/4dd543ff336c7af9e32bcc459787c8bfd353da772cef04bc1e9beedb375c8adc/687474703a2f2f706f7365722e707567782e6f72672f776166666c652d636f6d6d6f6e732f636f6e736f6c652f726571756972652f706870)](https://packagist.org/packages/waffle-commons/console)[![PHP CI](https://github.com/waffle-commons/console/actions/workflows/main.yml/badge.svg)](https://github.com/waffle-commons/console/actions/workflows/main.yml)[![codecov](https://camo.githubusercontent.com/075bd07511e33490335a76d74ffef5299da8651cf161d9090a7d362b0616bc17/68747470733a2f2f636f6465636f762e696f2f67682f776166666c652d636f6d6d6f6e732f636f6e736f6c652f67726170682f62616467652e7376673f746f6b656e3d64373461633632612d373837322d343033352d386238622d626363336166313939316530)](https://codecov.io/gh/waffle-commons/console)[![Latest Stable Version](https://camo.githubusercontent.com/797ba16e753fadf071bafcea494201ab1bc0cef12b08b1429b1f9652be032254/687474703a2f2f706f7365722e707567782e6f72672f776166666c652d636f6d6d6f6e732f636f6e736f6c652f76)](https://packagist.org/packages/waffle-commons/console)[![Latest Unstable Version](https://camo.githubusercontent.com/9cd35b45c54cddbc99de949d80b3c427c8b670e0286f6aa750c499afe0745d30/687474703a2f2f706f7365722e707567782e6f72672f776166666c652d636f6d6d6f6e732f636f6e736f6c652f762f756e737461626c65)](https://packagist.org/packages/waffle-commons/console)[![Total Downloads](https://camo.githubusercontent.com/bdd395184df9d50a42268e8078c8b4bec099b9bac869254b81890a5aabeafe95/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f776166666c652d636f6d6d6f6e732f636f6e736f6c652e737667)](https://packagist.org/packages/waffle-commons/console)[![Packagist License](https://camo.githubusercontent.com/9d905e45be956851498b58a941e49ab9abd63778907476ba89b56b80cf77dfe4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f776166666c652d636f6d6d6f6e732f636f6e736f6c65)](https://github.com/waffle-commons/console/blob/main/LICENSE.md)

Waffle Console Component
========================

[](#waffle-console-component)

> **Release:** `0.1.0-beta5` | [`CHANGELOG.md`](./CHANGELOG.md)

A minimalist, zero-magic CLI runtime for the Waffle Framework (RFC-012). Commands are registered **explicitly** at boot — no auto-discovery — and resolve their dependencies through constructor injection.

📦 Installation
--------------

[](#-installation)

```
composer require waffle-commons/console
```

🧱 Surface
---------

[](#-surface)

ClassRole`Waffle\Commons\Console\ConsoleApplication``final` implementation of `ConsoleApplicationInterface`. Owns the command registry and the run loop.`Waffle\Commons\Console\Command\AbstractCommand`Base class — implements `CommandInterface` with shared helpers.`Waffle\Commons\Console\Command\CacheClearCommand``cache:clear` — flushes the configured `CacheInterface` backend.`Waffle\Commons\Console\Command\RouteListCommand``route:list` — renders the compiled route table.`Waffle\Commons\Console\Command\SecurityAuditCommand``security:audit` — walks controllers and prints the resolved access ladder (`#[Rule]` / `#[Voter]`).`Waffle\Commons\Console\Command\MigrateCommand``db:migrate` — applies pending SQL migrations through the contracts `MigrationRunnerInterface`, then resets the pool.`Waffle\Commons\Console\Command\MemoryAuditCommand``igor:audit` — streams the monorepo-wide Igor memory-leak audit through the contracts `AuditRunnerInterface`.`Waffle\Commons\Console\Command\DataWarmupCommand``data:warmup` — pre-compiles SQR trees / routing tables into OPcache shared memory through the contracts `DataWarmerInterface` (Beta-3).`Waffle\Commons\Console\Maker\Command\Make*Command`The nine Waffle Maker scaffolders (RFC-020): `make:controller`, `make:dto`, `make:entity`, `make:repository`, `make:middleware`, `make:voter`, `make:command`, `make:http-client`, `make:event-pair`.`Waffle\Commons\Console\Input\ArgvInput``InputInterface` implementation parsing `argv`.`Waffle\Commons\Console\Output\StreamOutput`Default `OutputInterface` writing to `STDOUT` / `STDERR`.`Waffle\Commons\Console\Output\NullOutput`Silent `OutputInterface` for tests / quiet runs.`Waffle\Commons\Console\Exception\ConsoleException`Base exception (implements `ConsoleExceptionInterface`).`Waffle\Commons\Console\Exception\CommandNotFoundException`Thrown when `find($name)` cannot resolve.`Waffle\Commons\Console\Exception\InvalidArgumentException`Thrown on invalid CLI argument shape.🚀 Quick start
-------------

[](#-quick-start)

The exact signature of `ConsoleApplication::__construct`, verbatim from `src/ConsoleApplication.php`:

```
public function __construct(
    private readonly string $name = Constant::DEFAULT_APP_NAME,
    private readonly string $version = '0.0.0',
    private readonly OutputInterface $output = new StreamOutput(),
    ?array $argv = null, // null → reads $_SERVER['argv']
) { /* … */ }
```

And the run loop:

```
use Waffle\Commons\Console\ConsoleApplication;
use Waffle\Commons\Console\Command\CacheClearCommand;
use Waffle\Commons\Console\Command\RouteListCommand;

$app = new ConsoleApplication(name: 'Waffle', version: '0.1.0-beta0');

$app->add(new CacheClearCommand($cache));
$app->add(new RouteListCommand($router));

exit($app->run()); // argv read from constructor, returns int exit code
```

🪜 Public API
------------

[](#-public-api)

```
final class ConsoleApplication implements ConsoleApplicationInterface
{
    public function getName(): string;
    public function getVersion(): string;
    public function add(CommandInterface $command): void;
    public function has(string $name): bool;
    public function find(string $name): CommandInterface;  // throws CommandNotFoundException
    public function all(): array;
    public function run(): int;                            // returns ExitCode::*->value
}
```

`run()`:

1. With no arguments, prints the available-commands listing and exits with `ExitCode::USAGE`.
2. The built-in `list` command name reprints the same listing with `ExitCode::SUCCESS`.
3. `-v` / `-vv` / `-vvv` / `--verbose` / `--very-verbose` / `--debug` / `--quiet` flags adjust output verbosity via `OutputInterface::setVerbosity(Verbosity)`.
4. Dispatches to the resolved command's `execute(InputInterface, OutputInterface): int`.
5. `ConsoleExceptionInterface` and any other `Throwable` are caught and returned as `ExitCode::FAILURE`, with the message printed to stderr.

🐘 PHP 8.5 features used
-----------------------

[](#-php-85-features-used)

- `final class ConsoleApplication`.
- Constructor property promotion + `private readonly` on every dependency.
- Default `OutputInterface $output = new StreamOutput()` — PHP 8.1 `new in initializers`.
- `enum ExitCode: int` and `enum Verbosity` (from contracts) for typed exit codes / verbosity levels.
- Typed constants via `Waffle\Commons\Contracts\Console\Constant`.

🧭 Architectural boundary (`mago guard`)
---------------------------------------

[](#-architectural-boundary-mago-guard)

An active dependency **perimeter** is enforced on every CI run by `vendor/bin/mago guard` (bundled into `composer mago`; zero baselines). The rules live in [`mago.toml`](./mago.toml) under `[guard.perimeter]` — a forbidden `use` statement fails the build, not a reviewer.

Production code under `Waffle\Commons\Console` may depend **only** on:

- `Waffle\Commons\Console\**` — itself
- `Waffle\Commons\Contracts\**` — the shared contracts package, the **only** Waffle dependency permitted
- `Psr\**` — PSR interfaces
- `@global` + `Psl\**` — PHP core and the PHP Standard Library

Test code under `WaffleTests\Commons\Console` is unrestricted (`@all`). Structural rules are guarded too: interfaces must be named `*Interface`, `Exception\**` classes must end in `*Exception`, and any `Enum\**` namespace may hold only `enum` declarations.

Contract-first, component-agnostic by construction: components compose through `waffle-commons/contracts`, never directly through one another.

🧪 Testing
---------

[](#-testing)

```
docker exec -w /waffle-commons/console waffle-dev composer tests
```

📄 License
---------

[](#-license)

MIT — see [LICENSE.md](./LICENSE.md).

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance97

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~9 days

Total

7

Last Release

16d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/34a7557a3fb23aaf788ca3892b9b7efdf96e753264bafd0599153c9e8a921316?d=identicon)[LesliePetrimaux](/maintainers/LesliePetrimaux)

---

Top Contributors

[![supa-chayajin](https://avatars.githubusercontent.com/u/695448?v=4)](https://github.com/supa-chayajin "supa-chayajin (47 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/waffle-commons-console/health.svg)

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

###  Alternatives

[illuminate/console

The Illuminate Console package.

13046.0M6.8k](/packages/illuminate-console)[mallardduck/laravel-traits

A collection of useful Laravel snippets in the form of easy to use traits.

136.2k2](/packages/mallardduck-laravel-traits)

PHPackages © 2026

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