1. Go to this page and download the library: Download lijinma/commander 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/ */
lijinma / commander example snippets
use Lijinma\Commander;
->version('0.0.1')
->option('-p, --peppers', 'Add peppers')
->option('-P, --pineapple', 'Add pineapple')
->option('-b, --bbq', 'Add bbq sauce')
->option('-c, --cheese [type]', 'Add the specified type of cheese')
->parse($argv);
echo 'you ordered a pizza with:' . PHP_EOL;
if (isset($cmd->peppers)) {
echo ' - peppers' . PHP_EOL;
}
if (isset($cmd->pineapple)) {
echo ' - pineapple' . PHP_EOL;
}
if (isset($cmd->bbq)) {
echo ' - bbq' . PHP_EOL;
}
if (isset($cmd->cheese)) {
echo " - $cmd->cheese cheese" . PHP_EOL;
}
use Lijinma\Commander;
->version('0.0.1')
->command('rmdir <dir> [otherDirs...]', 'Remove the directory')
->action(
function ($dir, $otherDirs) {
echo 'You will remove the following directory: ' . $dir . PHP_EOL;
if ($otherDirs) {
echo 'And other directories: ' . implode(', ', $otherDirs) . PHP_EOL;
}
}
);
$cmd->command('rm <file>', 'Remove a file')
->action(
function ($file) {
echo 'You will remove the following file: ' . $file . PHP_EOL;
}
);
$cmd->parse($argv);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.