PHP Console Application made easy

adhocore

Jitendra

Posted on August 28, 2018

PHP Console Application made easy

GitHub logo adhocore / php-cli

PHP Console Application made easy- build great console apps with ease. Comes with Zero Dependency and Autocompletion support.

adhocore/cli

Framework agnostic Command Line Interface utilities and helpers for PHP. Build Console App with ease, fun and love.

Latest Version Build Scrutinizer CI Codecov branch StyleCI Software License Donate 15 Donate 25 Donate 50 Tweet

  • Command line application made easy
  • Inspired by nodejs commander (thanks tj)
  • Zero dependency.
  • For PHP7, PHP8 and for good

Screen Preview

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Helps you build bespoke, interactive console app easy and quick - includes commands, actions, argument parsing, colors, cursors, interaction and all that is required.

inspired by nodejs commander

Installation

composer install adhocore/cli

💖 💪 🙅 🚩
adhocore
Jitendra

Posted on August 28, 2018

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related