PHP code example of cadre / cliadr

1. Go to this page and download the library: Download cadre/cliadr 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/ */

    

cadre / cliadr example snippets


use Aura\Cli\CliFactory;
use Aura\Cli\Context;
use Aura\Cli\Help;
use Aura\Cli\Stdio;
use Cadre\CliAdr\Boot;
use Cadre\CliAdr\Input\HelpAwareInterface;

Interface {
    public function help(Help $help)
    {
        $help->setSummary('Hello, World');
        $help->setOptions([
            '#name?' => 'First name [default: "World"]',
        ]);

        return $help;
    }

    public function __invoke(Context $context)
    {
        $getopt = $context->getopt([]);
        return [$getopt->get(2, 'World')];
    }
});

$factory = new CliFactory();
$context = $factory->newContext($GLOBALS);
$stdio = $factory->newStdio();

exit($adr->run($context, $stdio));