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

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

magic-push/cli-toolkit
======================

CLI-oriented library for PHP scripts

v3.0.1(3mo ago)021MITPHPPHP &gt;=8.3

Since Nov 3Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/MagicPush/cli-toolkit)[ Packagist](https://packagist.org/packages/magic-push/cli-toolkit)[ RSS](/packages/magic-push-cli-toolkit/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)DependenciesVersions (6)Used By (0)

CliToolkit
==========

[](#clitoolkit)

[![Latest stable version](https://camo.githubusercontent.com/0aa7cfa2a781b62d2cd987f9a8c15237961062c02389d68280aca1b2589ff3cf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d616769632d707573682f636c692d746f6f6c6b69743f6c6162656c3d76657273696f6e)](https://packagist.org/packages/magic-push/cli-toolkit)

**CliToolkit** is a CLI-oriented library for PHP scripts.

Key features (why you would want to use it):

- create console scripts as [plain php-files](#plain-scripts)or classes (a classes' [launcher generator is provided](#script-classes));
- configure named (options) and positioned (arguments) parameters with ease using a config builder;
- define required options, optional arguments, lists of possible values, flags, array-like parameters and subcommands;
- enjoy [Bash completion](#completion) for options' names and parameters' possible values, when calling scripts via generated aliases; additionally, call your scripts from any path by those generated aliases;
- see generated help pages (using the built-in `--help` option) for your scripts based on your parameters configuration;
- zero dependencies (apart from PHP itself).

Contents
--------

[](#contents)

- [Installation](#installation)
- [How to](#how-to)
    - [Plain scripts](#plain-scripts)
    - [Completion](#completion)
    - [Script classes](#script-classes)
    - [More configuration examples](#more-configuration-examples)
- [CliToolkit values](#clitoolkit-values)
- [Inspiration and authors](#inspiration-and-authors)
- [More info](#more-info)

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

[](#installation)

```
composer require magic-push/cli-toolkit
```

How to
------

[](#how-to)

### Plain scripts

[](#plain-scripts)

Just create a php-file and start configuring:

```
// Configure your script parameters
$request = Parametizer::newConfig()
    ->newArgument('chunk-size') // A positioned parameter.
    ->newFlag('--dry-run') // A named boolean parameter.

    ->run();

// Read parameters
$chunkSize = $request->getParamAsInt('chunk-size');

// Process...

if (!$request->getParamAsBool('dry-run')) {
    // Make data changes.
}
```

If you want to read your script's documentation, then just call your script with `--help` option:

```
$ php path/to/my-cool-script.php --help

USAGE

  my-cool-script.php [--dry-run]

OPTIONS

  --dry-run

  --help      Show full help page.

ARGUMENTS

  (required)

```

Config and parameter builders will guide you with available options you can set up. If you set something odd, then built-in validators will show you corresponding errors:

```
$request = Parametizer::newConfig()
    ->newArgument('chunk-size')
    ->default(100)
    ->required()

    ->run();
```

```
$ php my-cool-script.php
'chunk-size' >>> Config error: a parameter can't be required and have a default value simultaneously.

```

### Script classes

[](#script-classes)

Generate a skeleton for your future class-based scripts:

```
php tools/cli-toolkit/run.php cli-toolkit:generate:launcher-skeleton
```

Read the output and comments in generated files.

The generated files will include completion script `local/completion.sh` and its generator script `generate-completion.sh` for your convenience, so you may skip the next section about [completion](#completion).

### Completion

[](#completion)

Generate a completion Bash script with aliases to your `Parametizer`-based scripts:

- (as an example) Enable completion for the library stock launcher. Execute the command below and read the output:

    ```
    php tools/cli-toolkit/run.php cli-toolkit:generate:completion-script \
        --search-directory-recursive=tools/cli-toolkit \
        --verbose
    ```
- Read the script's help page for parameter details and customize the command to detect your scripts:

    ```
    php tools/cli-toolkit/run.php cli-toolkit:generate:completion-script --help
    ```

### More configuration examples

[](#more-configuration-examples)

Check out the [stock class scripts](tools/cli-toolkit/ScriptClasses) (see `setUpConfig()`) as examples of class-based scripts, and `/**/scripts/*` files in [Tests](tests/Tests) subdirectories as artificial examples of plain scripts.

CliToolkit values
-----------------

[](#clitoolkit-values)

This library is being developed while keeping in mind these values:

- Scripts' development and maintenance should be quick and simple. The library users may focus on their scripts' unique logic instead of parameters or infrastructure management. The library builders and generators cover the latter.
- No dependencies apart from PHP and its standard modules. Updating the library should be a simple task: no dependencies - no extra libraries to worry about.

    The only tough part here is moving to the next major version.

Inspiration and authors
-----------------------

[](#inspiration-and-authors)

**CliToolkit** was inspired by and based on [Cliff](https://github.com/johnnywoo/cliff) project, so the first author is [Aleksandr Galkin](https://github.com/johnnywoo).

A part of ideas and code for [CliToolkit v1.0.0](docs/changelog.md#v100) was brought by [Anton Kotik](https://github.com/anton-kotik).

`Question` class was developed by [Vasiliy Borodin](https://github.com/borodin-vasiliy).

The rest is done by Kirill "Magic Push" Ulanovskii.

More info
---------

[](#more-info)

- [Features Manual](docs/features-manual.md) - more cool stuff to know about in details.
- [TODO](docs/todo.md) - the list of things I think would be cool to implement in the library.
- [Changelog](docs/changelog.md) - if you want to update the library safely.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance78

Regular maintenance activity

Popularity6

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 56.1% 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 ~110 days

Total

5

Last Release

119d ago

Major Versions

v1.0.0 → v2.0.02025-01-18

v2.1.0 → v3.0.02025-08-14

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

v2.0.0PHP &gt;=8.3

### Community

Maintainers

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

---

Top Contributors

[![MagicPush](https://avatars.githubusercontent.com/u/20456200?v=4)](https://github.com/MagicPush "MagicPush (83 commits)")[![johnnywoo](https://avatars.githubusercontent.com/u/245983?v=4)](https://github.com/johnnywoo "johnnywoo (64 commits)")[![miknatr](https://avatars.githubusercontent.com/u/1224182?v=4)](https://github.com/miknatr "miknatr (1 commits)")

---

Tags

clicli-scriptscompletionconsoleconsole-scriptslibraryphpphp-cliphp-librarycliconsolescriptscompletioncli-scriptsconsole-scripts

### Embed Badge

![Health badge](/badges/magic-push-cli-toolkit/health.svg)

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

###  Alternatives

[symfony/console

Eases the creation of beautiful and testable command line interfaces

9.8k1.1B11.3k](/packages/symfony-console)[nunomaduro/collision

Cli error handling for console/command-line PHP applications.

4.6k331.8M8.5k](/packages/nunomaduro-collision)[nunomaduro/termwind

It's like Tailwind CSS, but for the console.

2.5k239.8M286](/packages/nunomaduro-termwind)[wp-cli/php-cli-tools

Console utilities for PHP

68325.0M367](/packages/wp-cli-php-cli-tools)[php-school/cli-menu

A command line menu helper in PHP

2.0k1.1M27](/packages/php-school-cli-menu)[seld/cli-prompt

Allows you to prompt for user input on the command line, and optionally hide the characters they type

24725.8M17](/packages/seld-cli-prompt)

PHPackages © 2026

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