Saturday, July 5, 2014

CLIFramework - A command-line application framework for PHP and the difference between symfony/console

If you're using Symfony/Console component as your command-line application base library, you should already know the API design of Symfony/Console is pretty cumbersome, you need to write more lines of code to define an argument or an option.

Thus, you might want to know a simpler / powerful comand-line application framework, CLIFramework is designed for simplicity / extensibility.

The main difference between CLIFramework and Symfony/Console is that:

1. Fluent-style for command argument definition and option definition.

2. Option spec with concise expression.

3. Powerful ZSH completion generator. (With Symfony/Console, you have to write zsh completion script for each application.. "by hands!")

The zsh completion generator can convert your hierarchical commands / options into a zsh completion script.

Let's see the power of zsh completion generator, the following completion demo is used in phpbrew. The completion script is auto-generated by CLIFramework: