Download the PHP package corneltek/cliframework without Composer
On this page you can find all versions of the php package corneltek/cliframework. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download corneltek/cliframework
More information about corneltek/cliframework
Files in corneltek/cliframework
Package cliframework
Short Description Command-line framework for PHP
License MIT
Homepage http://github.com/c9s/CLIFramework
Informations about the package cliframework
CLIFramework
CLIFramework is a command-line application framework, for building flexiable, simple command-line applications.
Commands and Subcommands can be registered from outside of an application or your plugins.
Defining a new command is pretty simple, all you need to is declare a class which is inherited from CLIFramework\Command
class.
Features
-
Intuitive command class and option spec
-
command options are supported, powered by GetOptionKit. including long option, short option, required|optional|default value.
-
Hierarchical commands.
-
Automatic help page generation.
-
Automatic zsh completion generator.
-
Automatic bash completion generator.
-
Friendly message when command arguments are not enough.
-
Testable, CLIFramework provides PHPUnit test case for testing the commands in PHP.
-
Argument validation, suggestion,
-
Command Groups
- HHVM compatible
Synopsis
Automatic Zsh Completion Generator
Zsh Completion With Lazy Completion Values:
Bash Completion
Documentation
See documentation on our wiki https://github.com/c9s/CLIFramework/wiki
Command Forms
CLIFramework supports many command-line forms, for example:
$ app [app-opts] [subcommand1] [subcommand1-opts] [subcommand2] [subcommand2-opts] .... [arguments]
If the subcommand is not defined, you can still use the simple form:
$ app [app-opts] [arguments]
For example,
$ app db schema --clean dbname
$ app gen controller --opt1 --opt2 ControllerName
Subcommand Hierarchy
Commands have methods for stages, like prepare
, execute
, finish
, for a command like below:
$ app foo_cmd bar_cmd arg1 arg2 arg3
The call graph is like:
app->run
- app->prepare
- foo_cmd->prepare
- bar_cmd->prepare
- bar_cmd->execute
- bar_cmd->finish
- foo_cmd->finish
- app->finish
Basic Requirement
- PHP 5.3
Installation
From composer
Zsh Completion Generator
Console Prompt (Readline)
simple prompt:
$ php demo.php
Your name please:
prompt and except valid values:
Version Info
CLIFrameword has a built-in --version option, to setup the version info, you can simply override a const in your application class to setup version string:
This shows:
$ yourapp.php --version
YourApp - version 1.2.1
Example
Please check example/demo.php
$ php example/demo.php
ArgumentEditor
Message style formatter
Built-in styles:
'red' => array('fg' => 'red'),
'green' => array('fg' => 'green'),
'white' => array('fg' => 'white'),
'yellow' => array('fg' => 'yellow'),
'strong_red' => array('fg' => 'red', 'bold' => 1),
'strong_green' => array('fg' => 'green','bold' => 1),
'strong_white' => array('fg' => 'white','bold' => 1),
Building Phar Archive file
COMPOSER=tests/fixture/composer.json.phar-test composer install
php example/demo archive --working-dir /Users/c9s/work/php/CLIFramework \
--composer tests/fixture/composer.json.phar-test \
app.phar
Chooser Component
Debug Utilities
LineIndicator
ConsoleDebug class
Todos in the next release
- [ ] provide a easy way to define chained commands
- [ ] inheritable options for subcommands.
- [ ] human readable exception renderer.
- [ ] interact utilities
Hacking
Setup
-
Download & install Onion from https://github.com/phpbrew/Onion
-
Use Onion to bundle the dependencies:
$ onion bundle
-
Run tests, it should pass.
-
Hack hack hack.
-
Run tests.
- Send a pull request.
How command class register works
- CLIApplication is inherited from CommandBase.
- Command is also inherited from CommandBase.
- To register a subcommand, we use the
addCommand
method to register commands or subcommands.- The command class is optional, if command class name is omitted, then the
addCommand
method will try to guess the real command class, and try to load the command class.
- The command class is optional, if command class name is omitted, then the
All versions of cliframework with dependencies
corneltek/getoptionkit Version ~2.6.1
universal/universal Version 2.0.x-dev
corneltek/codegen Version 4.0.x-dev
pimple/pimple Version *
symfony/finder Version ~2.8|~3.0|^5.3.4
symfony/class-loader Version ~2.8|~3.0|~3.2