nia/routing-facade-cli

CLI routing facade to simply add CLI routes to a given router.

This package's canonical repository appears to be gone and the package has been frozen as a result.

1.0.1 2018-12-12 10:30 UTC

This package is not auto-updated.

Last update: 2022-03-03 23:25:58 UTC


README

CLI routing facade to simply add CLI routes to a given router.

Installation

Require this package with Composer.

composer require nia/routing-facade-cli

Tests

To run the unit test use the following command:

$ cd /path/to/nia/component/
$ phpunit --bootstrap=vendor/autoload.php tests/

How to use

The following sample shows you how to use the CLI routing facade component for a common use case.

$router = new Router();

// encapsulate the router into the facade.
$facade = new CliFacade($router);

// routes with additional conditions and filters.
// e.g.: bin/cli --update-inventory
$facade->cli($updateInventoryHandler, new ArgumentCondition('update-inventory'), $myFilters);

// cli fallback.
// e.g.: bin/cli
$facade->cli($showHelpHandler);