wegnermedia/commander
Composer 安装命令:
composer require wegnermedia/commander
包简介
Simple Command Handler Support
关键字:
README 文档
README
This Package gives you an easy way to throw Commands in a Command Bus.
Installation
Per usual, install Commander through Composer.
"require": { "wegnermedia/commander": "dev-master" }
Next, update app/config/app.php to include a reference to this package's service provider in the providers array.
'providers' => [ 'Wegnermedia\Commander\CommanderServiceProvider' ]
Next, add the facade app/config/app.php.
'aliases' => [ 'Commander' => 'Wegnermedia\Commander\Facades\Commander' ]
And now build something awesome.
Usage via Trait
<?php use Wegnermedia\Commander\CommanderTrait; class CartController extends ShopController { use CommanderTrait; /** * Add Item to Cart. * * @return Response */ public function addItem() { $inputs = Input::all(); // Validation goes here ... $command = new AddItemToCartCommand($inputs); $result = $this->execute($command); // ... create the Response } }
Usage via Facade
<?php class CartController extends ShopController { /** * Add Item to Cart. * * @return Response */ public function addItem() { $inputs = Input::all(); // Validation goes here ... $command = new AddItemToCartCommand($inputs); $result = Commander::execute($command); // ... create the Response } }
Done!
统计信息
- 总下载量: 15
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2014-07-21