1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28:
<?php
require __DIR__ . '/../vendor/autoload.php';
use splitbrain\phpcli\CLI;
use splitbrain\phpcli\Options;
class Minimal extends CLI
{
protected function setup(Options $options)
{
$options->setHelp('A very minimal example that does nothing but print a version');
$options->registerOption('version', 'print version', 'v');
}
protected function main(Options $options)
{
if ($options->getOpt('version')) {
$this->info('1.0.0');
} else {
echo $options->help();
}
}
}
$cli = new Minimal();
$cli->run();