nia/routing-facade-cli

CLI 路由外观库,用于简化向指定路由器添加 CLI 路由。

此包的规范仓库似乎已不存在,因此已冻结此包。

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 路由外观库,用于简化向指定路由器添加 CLI 路由。

安装

使用 Composer 需要此包。

composer require nia/routing-facade-cli

测试

运行单元测试,请使用以下命令

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

如何使用

以下示例展示了如何使用 CLI 路由外观组件解决常见问题。

$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);