cadre/cliadr

0.1.1 2017-03-18 03:11 UTC

README

This is a proof of concept command line Action-Domain-Responder (ADR) implementation.

It's heavily inspired by Radar.

Example

use Aura\Di\ContainerBuilder;
use Aura\Cli\CliFactory;

require __DIR__ . '/../vendor/autoload.php';

$di = (new ContainerBuilder())
    ->newConfiguredInstance([
        'Cadre\CliAdr\Config',
    ]);

$adr = $di->get('cadre:cliadr/adr');

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

$adr->route('test', function ($params) {
    return 'This is a test.';
});

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