Download the PHP package ekowabaka/clearice without Composer
On this page you can find all versions of the php package ekowabaka/clearice. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ekowabaka/clearice
More information about ekowabaka/clearice
Files in ekowabaka/clearice
Package clearice
Short Description A tool to help in the building of CLI apps. Provides command line parsing and simple console I/O interfaces.
License MIT
Informations about the package clearice
ClearIce PHP Command Line Argument Parser
ClearIce provides tools for PHP applications to help with parsing command line arguments, and performing interactive I/O sessions. Arguments supplied at the command line or through a shell are validated and supplied to your script in a consistently organized format. And gues what, there's also the added possibility of automatically generating help messages for your applications.
Installing
Although you can directly include the ClearIce scripts into your application, the best way of installing it is through composer.
composer require ekowabaka/clearice
ClearIce has no dependencies other than a PHP interpreter with version 7.1 or better.
Parsing Arguments with ClearICE
Let's get started with an example. If you ever wanted to parse command line arguments you can put ...
``
... in a file (which you can for example save as wiki.php). Then when you execute ...
php wiki.php generate --input=/home/james --output=/var/www/cool-wiki
... the output will be ...
Array
(
[input] => /input/path
[output] => /output/path
[__executed] => wiki.php
)
... and so will the following:
php test.php --input /input/path --output /output/path
php test.php -i/input/path -o/output/path
Interactive I/O with ClearICE
If you are interested in interactive I/O, entering this
``
could lead to an interaction like this:
What is your name [No Name]: ⏎
Okay No Name, where do you want to go (north/south/east/west) []: ⏎
A value is required.
Okay No Name, where do you want to go (north/south/east/west) []: home⏎
Please provide a valid answer.
Okay No Name, where do you want to go (north/south/east/west) []:
Hope you enjoy using ClearIce!