Binds icanboogie/http to ICanBoogie

v3.0.0 2018-03-17 23:29 UTC

This package is auto-updated.

Last update: 2020-09-07 22:11:06 UTC


Release Build Status Code Quality Code Coverage Packagist

The icanboogie/bind-http package binds icanboogie/http to ICanBoogie.

Defining domain dispatchers using config fragments

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:


// 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:


// …

$config = $app->configs['http_dispatchers'];

Prototype methods

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:


namespace ICanBoogie;

require 'vendor/autoload.php';

$app = boot();

$initial_request = $app->initial_request;
$request = $app->request;
$dispatcher = $app->dispatcher;

Event hooks

The following event hooks are attached:

  • ICanBoogie\Application::configure: Used to define an instance of ProvideDispatcher as dispatcher provider. This provider uses the http_dispatchers configuration to create the request dispatcher.


The package requires PHP 5.6 or later.


The recommended way to install this package is through Composer:

$ composer require icanboogie/bind-http

Cloning the repository

The package is available on GitHub, its repository can be cloned with the following command line:

$ git clone https://github.com/ICanBoogie/bind-http.git


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.


The test suite is ran with the make test command. PHPUnit and Composer need to be globally available to run the suite. The command installs dependencies as required. The make test-coverage command runs test suite and also creates an HTML coverage report in build/coverage. The directory can later be cleaned with the make clean command.

The package is continuously tested by Travis CI.

Build Status Code Coverage


icanboogie/bind-http is licensed under the New BSD License - See the LICENSE file for details.