PHPackages                             hoa/dispatcher - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. hoa/dispatcher

AbandonedLibrary[Utility &amp; Helpers](/categories/utility)

hoa/dispatcher
==============

The Hoa\\Dispatcher library.

1.17.05.02(9y ago)8163.6k↓32.6%7[6 PRs](https://github.com/hoaproject/Dispatcher/pulls)7BSD-3-ClausePHP

Since Sep 16Pushed 5y ago10 watchersCompare

[ Source](https://github.com/hoaproject/Dispatcher)[ Packagist](https://packagist.org/packages/hoa/dispatcher)[ Docs](https://hoa-project.net/)[ RSS](/packages/hoa-dispatcher/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (16)Used By (7)

 [![Hoa](https://camo.githubusercontent.com/2b5c32c5d4bc5e9298821b22d364a522e2dbc0295c1c011b1f9f86a4d07df07e/68747470733a2f2f7374617469632e686f612d70726f6a6563742e6e65742f496d6167652f486f612e737667)](https://camo.githubusercontent.com/2b5c32c5d4bc5e9298821b22d364a522e2dbc0295c1c011b1f9f86a4d07df07e/68747470733a2f2f7374617469632e686f612d70726f6a6563742e6e65742f496d6167652f486f612e737667)

---

 [![Build status](https://camo.githubusercontent.com/e0bff3d4ec9d3214378b4964e13574b3f65a08309867c24e12b2eccbb846d2ef/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f686f6170726f6a6563742f446973706174636865722f6d61737465722e737667)](https://travis-ci.org/hoaproject/Dispatcher) [![Code coverage](https://camo.githubusercontent.com/72a4eeca40a144408154f6a5db7496bb961032fcc115e45e1be95276298f1131/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f686f6170726f6a6563742f446973706174636865722f6d61737465722e737667)](https://coveralls.io/github/hoaproject/Dispatcher?branch=master) [![Packagist](https://camo.githubusercontent.com/5e580996aefe01ef9964130b1357fa438a8e9c7dc337c8aa089fce79b6d3c1ec/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f686f612f646973706174636865722e737667)](https://packagist.org/packages/hoa/dispatcher) [![License](https://camo.githubusercontent.com/41abf0a3c294d7367476ef5dc1201a85811e52bfbd6888032054d9ab0ee36898/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f686f612f646973706174636865722e737667)](https://hoa-project.net/LICENSE)

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

Hoa\\Dispatcher
===============

[](#hoadispatcher)

[![Help on IRC](https://camo.githubusercontent.com/4dbc9c9d28c30cf1ab591f4bb8212fe4dbddc734145df532a9bb86b09878d4c6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f68656c702d253233686f6170726f6a6563742d6666303036362e737667)](https://webchat.freenode.net/?channels=#hoaproject)[![Help on Gitter](https://camo.githubusercontent.com/8c4c85951788ff606b1268cb3dd946be05e3054795455d0a7b9250711bc2ac05/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f68656c702d6769747465722d6666303036362e737667)](https://gitter.im/hoaproject/central)[![Documentation](https://camo.githubusercontent.com/7059ad5f1a363f9098686c59d432f01d7330aed9d4b6c8111d985fd64cfc6c60/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63756d656e746174696f6e2d6861636b5f626f6f6b2d6666303036362e737667)](https://central.hoa-project.net/Documentation/Library/Dispatcher)[![Board](https://camo.githubusercontent.com/fd81654ba14b3aca3a713e1b471bc3fc3ba7b5bb3761ccffd6eea2e2ed1fa5ca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6f7267616e69736174696f6e2d626f6172642d6666303036362e737667)](https://waffle.io/hoaproject/dispatcher)

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](https://central.hoa-project.net/Resource/Library/Router) and the [`Hoa\View` library](https://central.hoa-project.net/Resource/Library/View).

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.

[Learn more](https://central.hoa-project.net/Documentation/Library/Dispatcher).

Installation
------------

[](#installation)

With [Composer](https://getcomposer.org/), to include this library into your dependencies, you need to require [`hoa/dispatcher`](https://packagist.org/packages/hoa/dispatcher):

```
$ composer require hoa/dispatcher '~1.0'
```

For more installation procedures, please read [the Source page](https://hoa-project.net/Source.html).

Testing
-------

[](#testing)

Before running the test suites, the development dependencies must be installed:

```
$ composer install
```

Then, to run all the test suites:

```
$ vendor/bin/hoa test:run
```

For more information, please read the [contributor guide](https://hoa-project.net/Literature/Contributor/Guide.html).

Quick usage
-----------

[](#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:

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

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

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

By default, the controller will be `Application\Controller\` and the action will be `Action`. Thus, for the request `/Foo/Bar.html`, we will call `Application\Controller\Foo::BarAction`.

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 `ActionAsync`.

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

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`.

Documentation
-------------

[](#documentation)

The [hack book of `Hoa\Dispatcher`](https://central.hoa-project.net/Documentation/Library/Dispatcher)contains detailed information about how to use this library and how it works.

To generate the documentation locally, execute the following commands:

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

More documentation can be found on the project's website: [hoa-project.net](https://hoa-project.net/).

Getting help
------------

[](#getting-help)

There are mainly two ways to get help:

- On the [`#hoaproject`](https://webchat.freenode.net/?channels=#hoaproject)IRC channel,
- On the forum at [users.hoa-project.net](https://users.hoa-project.net).

Contribution
------------

[](#contribution)

Do you want to contribute? Thanks! A detailed [contributor guide](https://hoa-project.net/Literature/Contributor/Guide.html) explains everything you need to know.

License
-------

[](#license)

Hoa is under the New BSD License (BSD-3-Clause). Please, see [`LICENSE`](https://hoa-project.net/LICENSE) for details.

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity40

Moderate usage in the ecosystem

Community26

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 92.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~73 days

Recently: every ~135 days

Total

14

Last Release

3303d ago

Major Versions

0.15.11.09 → 1.16.01.142016-01-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/a410060743cec0e0d8654661b726a7a25f5888f18059d4c942a8fd9a8128f0da?d=identicon)[Hoa](/maintainers/Hoa)

---

Top Contributors

[![Hywan](https://avatars.githubusercontent.com/u/946104?v=4)](https://github.com/Hywan "Hywan (98 commits)")[![vonglasow](https://avatars.githubusercontent.com/u/1275202?v=4)](https://github.com/vonglasow "vonglasow (4 commits)")[![shulard](https://avatars.githubusercontent.com/u/482993?v=4)](https://github.com/shulard "shulard (2 commits)")[![guiled](https://avatars.githubusercontent.com/u/311895?v=4)](https://github.com/guiled "guiled (1 commits)")[![stephpy](https://avatars.githubusercontent.com/u/232744?v=4)](https://github.com/stephpy "stephpy (1 commits)")

---

Tags

dispatcherhoalibraryphplibrarydispatcherkit

### Embed Badge

![Health badge](/badges/hoa-dispatcher/health.svg)

```
[![Health](https://phpackages.com/badges/hoa-dispatcher/health.svg)](https://phpackages.com/packages/hoa-dispatcher)
```

###  Alternatives

[league/iso3166

ISO 3166-1 PHP Library

69536.3M116](/packages/league-iso3166)[dekor/php-array-table

PHP Library for printing associative arrays as text table (similar to mysql terminal console)

296.6M2](/packages/dekor-php-array-table)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
