gameplayjdk/slim-console
Composer 安装命令:
composer require gameplayjdk/slim-console
包简介
The minimalistic slim framework console implementation.
README 文档
README
The minimalistic slim framework console implementation.
About
So, what exactly is this package?
Well, it is a simple library for Slim Framework 3 that allows you to call controller actions from the console.
It utilizes the strategy design pattern to provide a flexible way of parsing a given argv array.
You can find more information on the php argv variable here.
Further it provides a small middleware class, designed to stop web-access to these actions.
Installation
Run composer require gameplayjdk/slim-console.
Yes, it's that simple.
Usage
Initial setup:
<?php // ... $configuration = []; $console = new \Slim\Console\Console(); if ($console->isSupported()) { $configuration['environment'] = $console->getEnvironment($argv); } $configuration['settings'] = [ // ... ]; $app = new \Slim\App($configuration); // ...
Middleware usage:
<?php // ... $app->get('/cli/some-command', \App\Controller\CliController::class . ':someCommandAction') ->add($console->getMiddleware()); // ...
Call that action from the console:
php app.php cli some-command
License
The MIT license.
Open TODOs
- Write up some unittests
- More
ArgvParserInterfaceimplementations
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-09-15