Documentation
Features
CLI with interactive mode
toKernel makes writing applications working in command line mode very simple.
For example, if you have the addon "home" with action "cli_welcome", you can write your own addon "my_addon" and run it by using call like:
/usr/bin/php index.php --addon my_addon --action my_func --param1 param1_value --param2 param2_value
With toKernel, interactive mode applications are quite simple as well, which is quite an advantage.
How does it work? Have a look at the code below, which should be more or less self-explanatory.This picture is the result of runing code:
This picture is the result of runing code:
$this->lib->cli->out('Welcome to toKernel', 'red');
$this->lib->cli->out("\n"); // or TK_NL constant
$this->lib->cli->out('Please enter your name:', 'green');
$name = $this->lib->cli->in();
$this->lib->cli->out('Hello ' . $name, 'yellow');
To get all possible colors in CLI mode call:
$this->lib->cli->output_colors();
Another working example of command line interactive mode.