diversen / cli-framework
A simple CLI framework built around pear-commandline
Installs: 182
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/diversen/cli-framework
Requires
- php: >=5.3.0
- diversen/simple-php-classes: ^1.4
- pear-pear.php.net/console_color: ^1.0
- pear-pear.php.net/console_commandline: ^1.2
- pear-pear.php.net/pear: ^1.10
README
A simple CLI framework built with PEAR console_commandline and PEAR console_color.
Install
You will need to have the PEAR repositories
enabled in your base composer.json
file:
"repositories": [ { "type": "pear", "url": "https://pear.php.net" } ],
composer require diversen/cli-framework
Example:
There is a simple example. You can test it by creating a file called example
,
and add the following piece of code.
#!/usr/bin/env php <?php include_once "vendor/autoload.php"; use diversen\cli\example; example::init(); example::run();
Run the example:
chmod +x example
./example
The example class can found be found in src/cli/example.php
The example class loads all commands found in the folder src/cli/example
There is only one base command, with two sub-commands, and it can take one optional argument. This looks like this: src/cli/commands/miau.php