PHPackages                             lawondyss/parex-commander - 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. lawondyss/parex-commander

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

lawondyss/parex-commander
=========================

Lightweight PHP tool for creating interactive terminal applications

1.0.1(1y ago)31MITPHPPHP ^8.2

Since Apr 6Pushed 1y ago2 watchersCompare

[ Source](https://github.com/Lawondyss/ParexCommander)[ Packagist](https://packagist.org/packages/lawondyss/parex-commander)[ RSS](/packages/lawondyss-parex-commander/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (4)Versions (3)Used By (0)

Parex Commander
===============

[](#parex-commander)

[![Latest Version](https://camo.githubusercontent.com/659bf92f196f07dde33e105802db0c33d0dde803f52f3c8f255b00b08199c58e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c61776f6e647973732f70617265782d636f6d6d616e6465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lawondyss/parex-commander)[![License](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE)

Parex Commander is a lightweight PHP library designed to simplify the creation of interactive CLI applications. It provides a structured and intuitive way to define commands, handle input/output, and manage the overall flow of your application.

Built on top of the [Parex](https://packagist.org/packages/lawondyss/parex) library.

Key Features
------------

[](#key-features)

- **Command-Based Structure:** Organize your CLI application into logical commands, each with its own set of arguments and options.
- **Simplified Input/Output:** Easily handle user input and format output using the built-in IO system.
- **Extensible:** Easily extend the core functionality with your own custom commands and features.
- **Clean and Readable Code:** Designed with a focus on code clarity and maintainability.

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

[](#installation)

You can install Parex Commander via Composer:

```
bash composer require lawondyss/parex-commander
```

Core Components
---------------

[](#core-components)

### `ParexCommander`

[](#parexcommander)

The `ParexCommander` class is the heart of your CLI application. It's responsible for:

- Registering and managing commands.
- Parsing user input and routing it to the appropriate command.
- Handling the overall execution flow.

**Example:**

```
// Handlers
function day(DynamicResult $result, IO $io): void { $io->writeLn('☀️'); }
function night(DynamicResult $result, IO $io): void { $io->writeLn('🌙'); }

// Commands of Day & Night application
$commander = new ParexCommander('Day & Night', 'Something small and simple');
$commander->addCommand('day', day(...));
$commander->addCommand('night', night(...));

$commander->run();
```

See [example](examples/application.php) for more.

### `Command`

[](#command)

The `Command` class represents a single command within your application. It allows you to:

- Define the command's name, description, and version.
- Specify the arguments and options that the command accepts.
- Implement the command's logic in a handler function or invokable class.

**Example:**

```
$commander->addCommand('migrate', migrate(...), 'Run missing migrations.')
          ->addOptional('id', help: 'Specifies a particular migration.', multiple: true)
          ->addFlag('dry-run', help: 'It simulates running the migration, but does not execute SQL.');
```

Or you can use the class on its own, see [example](examples/command.php) for more.

### `IO`

[](#io)

The `IO` class provides a simple and consistent way to interact with the user. It handles:

- Writing output to the console.
- Asking questions.
- Requires confirmation.
- Offers a selection of.

Better see [example](examples/io.php).

Note
----

[](#note)

All examples are executable, just try them out 😉

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance47

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity51

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 ~1 days

Total

2

Last Release

400d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1f642f8a219fdaad6b73c302bfc3a623148b8eefd58ea4078cdfae1f24c47fc5?d=identicon)[Lawondyss](/maintainers/Lawondyss)

---

Top Contributors

[![Lawondyss](https://avatars.githubusercontent.com/u/272130?v=4)](https://github.com/Lawondyss "Lawondyss (18 commits)")

---

Tags

phpcliconsoleterminalshellcommandapplication

###  Code Quality

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/lawondyss-parex-commander/health.svg)

```
[![Health](https://phpackages.com/badges/lawondyss-parex-commander/health.svg)](https://phpackages.com/packages/lawondyss-parex-commander)
```

###  Alternatives

[league/climate

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

1.9k14.0M273](/packages/league-climate)[seregazhuk/php-watcher

Automatically restart PHP application once the source code changes

394137.8k4](/packages/seregazhuk-php-watcher)[alecrabbit/php-console-spinner

Extremely flexible spinner for \[async\] php cli applications

24032.0k2](/packages/alecrabbit-php-console-spinner)[php-school/learn-you-php

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

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

PHPackages © 2026

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