Package to dispach request to controller. Uses FcPhp Di to find Controller instance.
Composer:
$ composer require 00f100/fcphp-dispach
or add in composer.json
{
"require": {
"00f100/fcphp-dispach": "*"
}
}
Configure Dependency Injection with FcPhp Di
use FcPhp\Di\Facades\DiFacade;
use FcPhp\Controller\Controller;
// Class example ...
class ExampleController extends Controller
{
public function findAll($foo, $bar)
{
return compact('foo', 'bar');
}
}
// Configure class into FcPhp Di
$di = DiFacade::getInstance();
$di->set('ExampleController', 'ExampleController');
use FcPhp\Dispach\Facades\DispachFacade;
// Init Dispach
$instance = DispachFacade::getInstance();
/*
Return ExampleController->findAll('foo_value', 'bar_value'):
Array (
'foo' => 'foo_value',
'bar' => 'bar_value'
)
*/
print_r($instance->dispach('ExampleController@findAll', ['foo_value', 'bar_value']));