PHPackages                             jdwx/cli - 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. jdwx/cli

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

jdwx/cli
========

An extensible CLI framework.

v1.1.0(1mo ago)15161MITPHPPHP &gt;=8.3.0

Since Apr 6Pushed 2w ago1 watchersCompare

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

READMEChangelog (10)Dependencies (16)Versions (22)Used By (1)

jdwx/cli
========

[](#jdwxcli)

PHP framework for developing extensible PHP CLIs.

This provides a strong foundation for developing PHP command-line interfaces (CLIs). It is designed to be easy to use and easy to extend and to provide features that can be tedious to implement from scratch.

It provides:

- Command line editing through readline.
- Command parser with support for single and double-quoted strings, escape sequences, and backquoted command substitution.
- Variable substitution in command strings. (Supports both ${var} and $var syntax.)
- Command autocompletion and context-aware help.
- A handful of common built-in commands (e.g., echo and expr).
- Command line history view, search, and re-run.
- \# comments.

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

[](#installation)

You can require it directly with Composer:

```
composer require jdwx/cli
```

Or download the source from GitHub:

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

[](#requirements)

This library requires PHP 8.3 or later with the readline extension.

Usage
-----

[](#usage)

Using this framework involves two steps:

1. Creating commands that extend the AbstractCommand class and implement a run() method. These classes have constant properties that define the command name, help text, usage examples, aliases and (where applicable) predefined options. See the builtin commands for details.
2. Subclass the Interpreter class and add your commands in the constructor with the addCommandClass() method. Instantiate your interpreter subclass and call the run() method to start the interpreter. The php\_sh.php file in the bin directory provides a simple example of how to do this.

Arguments are passed to the command using the [Arguments](https://github.com/jdwx/args)class. For complex applications, you may want to subclass Arguments to provide additional methods to handle types relevant to your application. If you do, it is generally helpful to create an abstract subclass of AbstractCommand that defines a signature for the run() method using your custom Arguments subclass. E.g.:

```
abstract class MyCommand extends AbstractCommand {

    abstract public function run( MyArguments $args );

}
```

Then use that as the parent class of your custom commands.

The Command class is provided for use when the generic Arguments implementation is sufficient.

Stability
---------

[](#stability)

This framework is considered stable and is used in production code. However, it has been refactored and improved for general use, and those features may not be as well-tested.

History
-------

[](#history)

This framework has been in production for many years. It was refactored out of a larger codebase and released as an open-source standalone module in 2024.

There is a method called addCommand() that is present for historical reasons. It is used extensively in legacy code that implements commands as methods of the Interpreter class instead of separate classes, resulting in unmaintainable 10,000-line classes. It is retained for compatibility for now because refactoring those classes is exactly as quick and pleasant as you'd expect (i.e., not at all). It absolutely **must not** be used in new code. We look forward to removing it someday. When that day arrives, no advance warning will be given.

###  Health Score

51

—

FairBetter than 95% of packages

Maintenance95

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity66

Established project with proven stability

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

Recently: every ~65 days

Total

21

Last Release

31d ago

PHP version history (2 changes)v1.0.0PHP &gt;=8.2.0

v1.0.16PHP &gt;=8.3.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/f71b4b976170f89eac19be48c7381a27c49ed8c9cb5e8e6ff05a2ad7583efa13?d=identicon)[jdwx](/maintainers/jdwx)

---

Top Contributors

[![jdwx](https://avatars.githubusercontent.com/u/2722779?v=4)](https://github.com/jdwx "jdwx (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/jdwx-cli/health.svg)

```
[![Health](https://phpackages.com/badges/jdwx-cli/health.svg)](https://phpackages.com/packages/jdwx-cli)
```

###  Alternatives

[symfony/cache

Provides extended PSR-6, PSR-16 (and tags) implementations

4.2k365.0M3.1k](/packages/symfony-cache)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.6k38.2k](/packages/matomo-matomo)[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)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[crunzphp/crunz

Schedule your tasks right from the code.

2342.3M7](/packages/crunzphp-crunz)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

562565.8k42](/packages/ecotone-ecotone)

PHPackages © 2026

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