00f100 / fcphp-dispach
Library to dispach request to controller
Installs: 34
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
Type:package
Requires
- php: >=7.2
- 00f100/fcphp-controller: *
- 00f100/fcphp-di: *
Requires (Dev)
- 00f100/phpdbug: *
- phpunit/phpunit: 6.*
This package is auto-updated.
Last update: 2024-12-18 06:30:46 UTC
README
Package to dispach request to controller. Uses FcPhp Di to find Controller instance.
How to install
Composer:
$ composer require 00f100/fcphp-dispach
or add in composer.json
{ "require": { "00f100/fcphp-dispach": "*" } }
How to use
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');
Get instance and run Dispach
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']));