Binds icanboogie/http to ICanBoogie
Domain dispatchers may be defined using configuration fragments. One actually define dispatcher constructors as a class name or a callable, that would return a dispatcher. Constructor class should extend the AbstractDispatcherConstructor.
The following example demonstrates how some domain dispatchers may be defined:
<?php // config/http.php use ICanBoogie\Binding\HTTP\DispatcherConfig as Config; return [ 'dispatchers' => [ 'pages' => [ Config::CONSTRUCTOR => \Icybee\Modules\Pages\PageDispatcher::class, Config::WEIGHT => Config::WEIGHT_BOTTOM ], 'routing' => \ICanBoogie\Routing\RouteDispatcher::class, 'operation' => [ Config::CONSTRUCTOR => \ICanBoogie\Operation\OperationDispatcher::class, Config::WEIGHT => Config::WEIGHT_BEFORE_PREFIX . 'routing' ] ] ];
The dispatchers configuration may be obtained through the application:
<?php // … $config = $app->configs['http_dispatchers'];
The following prototype methods are defined, the ApplicationBindings trait may be used for type hinting:
ICanBoogie\Application::get_initial_request: Returns the initial request.
ICanBoogie\Application::get_request: Returns the current request.
ICanBoogie\Application::get_dispatcher: Returns the request dispatcher.
The following example demonstrates how this getters may be used:
<?php namespace ICanBoogie; require 'vendor/autoload.php'; $app = boot(); $initial_request = $app->initial_request; $request = $app->request; $dispatcher = $app->dispatcher;
The following event hooks are attached:
ICanBoogie\Application::configure: Used to define an instance of ProvideDispatcher as dispatcher provider. This provider uses the
http_dispatchersconfiguration to create the request dispatcher.
The package requires PHP 7.2 or later.
composer require icanboogie/bind-http
The package is documented as part of the ICanBoogie framework documentation. You can
generate the documentation for the package and its dependencies with the
make doc command. The
documentation is generated in the
build/docs directory. ApiGen is required.
The directory can later be cleaned with the
make clean command.
make test-container to create and log into the test container, then run
make test to run the
test suite. Alternatively, run
make test-coverage to run the test suite with test coverage. Open
build/coverage/index.html to see the breakdown of the code coverage.
icanboogie/bind-http is released under the New BSD License.