Package Data | |
---|---|
Maintainer Username: | wegnermedia |
Maintainer Contact: | stefan@wegnermedia.de (Stefan Wegner) |
Package Create Date: | 2014-07-21 |
Package Last Update: | 2014-07-22 |
Language: | PHP |
License: | Unknown |
Last Refreshed: | 2024-11-19 03:01:03 |
Package Statistics | |
---|---|
Total Downloads: | 13 |
Monthly Downloads: | 2 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 2 |
Total Forks: | 0 |
Total Open Issues: | 0 |
This Package gives you an easy way to throw Commands in a Command Bus.
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.
<?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
}
}
<?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!