adhocore/cli
Framework agnostic Command Line Interface utilities and helpers for PHP. Build Console App with ease, fun and love.
- Command line application made easy
- Inspired by nodejs commander (thanks tj)
- Zero dependency.
- For PHP7, PHP8 and for good
What's included
Core: Argv parser · Cli application · Shell
IO: Colorizer · Cursor manipulator · Stream writer · Stream reader
Other: Autocompletion
Installation
# PHP8.0 and above v1.0.0
composer require adhocore/cli:^v1.0.0
# PHP 7.x
composer require adhocore/cli:^v0.9.0
Usage
Argv parser
$command = new Ahc\Cli\Input\Command('rmdir', 'Remove dirs')
$command
->version('0.0.1-dev')
// Arguments are separated by space
// Format: `<name>` for required, `[name]` for optional
// `[name:default]` for default value, `[name...]` for variadic (last argument)
->arguments('<dir> [dirs...]')
// `-h --help`, `-V --version`, `-v --verbosity` options are already added by default.
// Format: `<name>` for
…