teraone/slim-cli
最新稳定版本:2.0.0
Composer 安装命令:
composer require teraone/slim-cli
包简介
Making a mock GET request through the CLI and enabling the same application entry point on CLI scripts.
README 文档
README
Slim 3 Framework CLI Request Middleware
This middleware will transform a CLI call into a GET Request. It is based on https://github.com/pavlakis/slim-cli but does not use the method paramter.
Add it with composer
composer require teraone/slim-cli
Pass the parameters in this order
route / query string
php public/index.php /status event=true
Add it in the middleware section of your application
$app->add(new \Teraone\SlimCli\CliRequest());
Pass a route to test it with
$app->get('/status', 'YourNameSpace\YourController:yourMethod') ->setName('status');
Check you're only using a CLI call
final class YourController { ... public function yourMethod(Request $request, Response $response, $args) { // ONLY WHEN CALLED THROUGH CLI if (PHP_SAPI !== 'cli') { return $response->withStatus(404)->withHeader('Location', '/404'); } if (!$request->getParam('event')) { return $response->withStatus(404)->withHeader('Location', '/404'); } ... } }
Credits
Based on Bobby DeVeaux's (@bobbyjason) Gulp Skeleton
统计信息
- 总下载量: 1.22k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2017-05-05