1. Go to this page and download the library: Download lotfio/conso library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lotfio / conso example snippets
composer
composer test
#!/usr/bin/env php
declare(strict_types=1);
use Conso\{
Conso,Input,Output
};
nds.php';
$conso->run();
$conso->setSignature(); // set application signature (top logo)
$conso->setName(); // set application name
$conso->setVersion(); // set application version
$conso->setAuthor(); // set application author
$conso->disableBuiltInCommands(); // disable builtin commands
// this is your commands file
// test command
$conso->command("test", function($input, $output){
$output->writeLn("\n hello from test \n", 'red');
});
// test command
$conso->command("test", function($input, $output){
$output->writeLn("\n hello from test \n", 'red');
})->description("This is test command description :) ^^");
// test command
$conso->command("test", function($input, $output){
if($input->subCommand() == 'one')
exit($output->writeLn("\n hello from one \n", 'yellow'));
if($input->subCommand() == 'two')
$output->writeLn("\n hello from two \n", 'green');
})->description("This is test command description :) ^^")->sub('one', 'two');
// test command
$conso->command("test", function($input, $output){
if($input->flag('-t') !== false)
$output->writeLn("\n flag -t is defined for this command.\n", 'red');
// you can get flag values
// $output->writeLn($input->flag('-t'));
})->description("This is test command description :) ^^")->flags('-t');
// test command
$conso->command("test", function($input, $output){
$output->writeLn("\n test called by alias \n", 'red');
})->description("This is test command description :) ^^")->alias('alias');
// test command
$conso->command("test", function($input, $output){
$output->writeLn("\n test called by alias \n", 'red');
})->description("This is test command description :) ^^")->sub('one')->flags('-t')
->help([
"sub commands" => [
"one" => " help text for sub command goes here"
],
"flags" => [
"-t" => "help text for flag goes here"
]
]);
$conso->group('my group of commands:', function($conso){
$conso->command("command", function(){})->description('This is command description');
$conso->command("test", function(){})->description('This is command description');
$conso->command("make", function(){})->description('This is command description');
});
// add this to your conso file before run method
$conso->setCommandsPath('app/Commands');
$conso->setCommandsNamespace('App\\Commands');
declare(strict_types=1);
use Conso\{
Conso,Input,Output
};
e HttpCommand';
$input = new Input($command);
$conso = new Conso($input, new Output);
// no need for shebang it will be added automatically
declare(strict_types=1);
use Conso\{
Conso,Input,Output
};
app signature ");
$conso->disableBuiltInCommands(); // disable conso built in commands
// include your commands
//
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.