2017 © Pedro Peláez
 

library dispatcher

The Hoa\Dispatcher library.

image

hoa/dispatcher

The Hoa\Dispatcher library.

  • Tuesday, March 6, 2018
  • by Hoa
  • Repository
  • 11 Watchers
  • 7 Stars
  • 54,649 Installations
  • PHP
  • 9 Dependents
  • 1 Suggesters
  • 8 Forks
  • 9 Open issues
  • 15 Versions
  • 3 % Grown

The README.md

Hoa , (*1)


Build status Code coverage Packagist License , (*2)

Hoa is a modular, extensible and structured set of PHP libraries.
Moreover, Hoa aims at being a bridge between industrial and research worlds. , (*3)

Hoa\Dispatcher

Help on IRC Help on Gitter Documentation Board, (*4)

This library dispatches a task defined by some data on a callable, or with the appropriated vocabulary, on a controller and an action. It is often used in conjunction with the Hoa\Router library and the Hoa\View library., (*5)

The link between libraries and the application is represented by a kit which aggregates all important data, such as the dispatcher, the router, the view and data associated to the view., (*6)

Learn more., (*7)

Installation

With Composer, to include this library into your dependencies, you need to require hoa/dispatcher:, (*8)

$ composer require hoa/dispatcher '~1.0'

For more installation procedures, please read the Source page., (*9)

Testing

Before running the test suites, the development dependencies must be installed:, (*10)

$ composer install

Then, to run all the test suites:, (*11)

$ vendor/bin/hoa test:run

For more information, please read the contributor guide., (*12)

Quick usage

We propose a quick overview of the basic dispatcher represented by the class Hoa\Dispatcher\Basic which is able to dispatch a task on three kinds of callables:, (*13)

  • lambda function (as a controller, no action);
  • function (as a controller, no action);
  • class and method (respectively as a controller and an action).

We will focus on the last kind with this following example:, (*14)

$router = new Hoa\Router\Http();
$router->get('w', '/(?<controller>[^/]+)/(?<action>\w+)\.html');

$dispatcher = new Hoa\Dispatcher\Basic();
$dispatcher->dispatch($router);

By default, the controller will be Application\Controller\<Controller> and the action will be <Action>Action. Thus, for the request /Foo/Bar.html, we will call Application\Controller\Foo::BarAction., (*15)

It is possible to specify a different controller and action names if the request is asynchronous. By default, only the action name is different with the value <Action>ActionAsync., (*16)

With all kinds of callables, the basic dispatcher will distribute captured data (with the (?<name>…) PCRE syntax) on callable arguments where the name matches the argument name. For example, with a rule such as '/hello_(?<nick>\w+)', if the callable has an argument named $nick, it will receive the value gordon for the request /hello_gordon., (*17)

The kit is reachable through the $_this argument or $this variable if the controller is a class that extends Hoa\Dispatcher\Kit. The kit propose four elementary attributes, which are: router, dispatcher, view and data., (*18)

Documentation

The hack book of Hoa\Dispatcher contains detailed information about how to use this library and how it works., (*19)

To generate the documentation locally, execute the following commands:, (*20)

$ composer require --dev hoa/devtools
$ vendor/bin/hoa devtools:documentation --open

More documentation can be found on the project's website: hoa-project.net., (*21)

Getting help

There are mainly two ways to get help:, (*22)

Contribution

Do you want to contribute? Thanks! A detailed contributor guide explains everything you need to know., (*23)

License

Hoa is under the New BSD License (BSD-3-Clause). Please, see LICENSE for details., (*24)

The Versions

06/03 2018

dev-master

9999999-dev https://hoa-project.net/

The Hoa\Dispatcher library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

library dispatcher kit

02/05 2017

1.17.05.02

1.17.05.02 https://hoa-project.net/

The Hoa\Dispatcher library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

library dispatcher kit

10/01 2017

1.17.01.10

1.17.01.10 https://hoa-project.net/

The Hoa\Dispatcher library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

library dispatcher kit

14/01 2016

1.16.01.15

1.16.01.15 http://hoa-project.net/

The Hoa\Dispatcher library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

library dispatcher kit

14/01 2016

1.16.01.14

1.16.01.14 http://hoa-project.net/

The Hoa\Dispatcher library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

library dispatcher kit

09/11 2015

0.15.11.09

0.15.11.09 http://hoa-project.net/

The Hoa\Dispatcher library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

library dispatcher kit

29/05 2015

0.15.05.29

0.15.05.29 http://hoa-project.net/

The Hoa\Dispatcher library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

library dispatcher kit

16/04 2015

0.15.04.16

0.15.04.16 http://hoa-project.net/

The Hoa\Dispatcher library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

library dispatcher kit

09/01 2015

0.15.01.23

0.15.01.23 http://hoa-project.net/

The Hoa\Dispatcher library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

library dispatcher kit

09/12 2014

0.14.12.10

0.14.12.10 http://hoa-project.net/

The Hoa\Dispatcher library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

library dispatcher kit

25/11 2014

0.14.11.26

0.14.11.26 http://hoa-project.net/

The Hoa\Dispatcher library.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

library dispatcher kit

05/10 2014

0.14.11.09

0.14.11.09 http://hoa-project.net/

The Hoa\Dispatcher library.

  Sources   Download

BSD-3-Clause

The Requires

 

library dispatcher kit

23/09 2014

0.14.09.23

0.14.09.23 http://hoa-project.net/

The Hoa\Dispatcher library.

  Sources   Download

BSD-3-Clause

The Requires

 

library dispatcher kit

17/09 2014

0.14.09.17

0.14.09.17 http://hoa-project.net/

The Hoa\Dispatcher library.

  Sources   Download

BSD-3-Clause

The Requires

 

library dispatcher kit

16/09 2014

0.14.09.16

0.14.09.16 http://hoa-project.net/

The Hoa\Dispatcher library.

  Sources   Download

BSD-3-Clause

The Requires

 

library dispatcher kit