PHPackages                             dasprid/dash - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. dasprid/dash

AbandonedArchivedLibrary[HTTP &amp; Networking](/categories/http)

dasprid/dash
============

Flexible PSR-7 compliant HTTP router

1.1.0(10y ago)30759[1 issues](https://github.com/DASPRiD/Dash/issues)[1 PRs](https://github.com/DASPRiD/Dash/pulls)BSD-2-ClausePHPPHP ^5.5|^7.0

Since Nov 21Pushed 10y ago1 watchersCompare

[ Source](https://github.com/DASPRiD/Dash)[ Packagist](https://packagist.org/packages/dasprid/dash)[ Docs](https://github.com/DASPRiD/Dash)[ RSS](/packages/dasprid-dash/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (5)Versions (19)Used By (0)

```
                            ▄▄
                       █▀▀▄█░░█▄         ▄▄▄▄▀▀▀▀▀▀▄
                        ▀▄░░██░░█   █▀▀▀▀▀▓▓▓▓▓▓▒▓▄▄▓▀▄
    ▄▄▄▄▄▄  █▄         ▄▄█░░▀▄░█ ▄▄█▀▄▄▀▀█▒▒▒▄▄▀░▀▀██
  ▄█▀▀▀▀▀▀██▓█        █░▀█░░█░█▀▀▄▄█░░░▄▀▀▀▀░░░░░░░█
▄█▄▄▄░░░▒▒▒▀█▓█        ▀▄░█▀█▀▀█▀▄█▄▄▄▀░░░░▀▀█▀▀██░█
     ▀▀▄▓▓▓▒▒█▄▀▄      ▄▄█▀▀▄░░░█    █░░░░░░ ▀███░░░█▄
        ▀▄▄▓░▒▒▀█▄█▀▀▀▀▒▀█▄█▀░░█▀▀▀▀▀░█░░░░░░░░░░░▄░█
           ▀▀▄▄▓▓░░░░░▓▓▓▓▄█ ▀▄▄░▀░░░░░░░░░▄▄▄▄▄▄▄▄▄▄▀▀
               ▀▄▓▓▓▓▓▄▄▄▀  █▓▒░░░░░░░░░░░█▄▀▀▀█▄▄▄▄▄▄▄
                 ▀▀▀▀▀      ▄▀█░▓▒░░░░▄░░░█░▀░▄▄░░█▒▒▒▒▒▒▒█
                         ▄▄▄▀▀░░░░░░░░▄██▀▀▀▀▀▀█▀░░█▀▀▀▄▄▄▀
    DASH                █░░░░░▄▄▀█▄▄▄▀▀         █░░░█
                        █░░▄▄█▒▒▄▀               █░▄▀
                        ▀▀▀  ▀▀▀                  ▀

```

---

[![Build Status](https://camo.githubusercontent.com/51e277fc1f45aa2eab694df61db809010beff8f56e347ce3ea21415b1483b034/68747470733a2f2f6170692e7472617669732d63692e6f72672f444153505269442f446173682e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/DASPRiD/Dash)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/2026a14b2dbd8fc7607340343025403c196118055a94a930bae95a927efefa6c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f444153505269442f446173682f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/DASPRiD/Dash/?branch=master)[![Coverage Status](https://camo.githubusercontent.com/1a2d43c26ac3c30802c0e54364b6f14858e41e3381e223a66d8ed870696f9342/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f444153505269442f446173682f62616467652e706e673f6272616e63683d6d6173746572)](https://coveralls.io/r/DASPRiD/Dash)

Dash is a router which was initially meant to be a router for Zend Framework 3, but by now evolved into its very own package. It has a dependency on ZF's ServiceManager, but purely for its plugin manager implementation.

Installation
============

[](#installation)

Dash is supposed to be used with a dependency container, but can in theory be used without one. In the average case where you are using Dash with another framework which supplies you a dependency container, there is a file placed in the config directory, which includes all factories which have to be registered. These factories assume that your container also supplies a config array via the name "config". For specific contents of it, refer to the examples below.

Withint your application, you can easily retrieve the dependency config by instantiating `Dash\ConfigProvider`. Since it implements an \_\_invoke() method, it can be used with config managers like expressive-config-manager.

Route Configuration
===================

[](#route-configuration)

Route configuration is greatly simplified from ZF2, routes now have an (optional) 3 key indexed array as the first 3 parameters, the format for the shortcut parameters are:

`[path, defaults, methods]`

This may feel counter intuitive, but the idea is that the most frequently changed parameter appears earliest in the order so that when defining child routes you can skip parameters you wish to inherit.

`path`, will expect a string, whereas `defaults` will expect an array and `method` will expect either an array of methods this route should match, a single method in a string, or a string of `'*'` for all methods. An empty string `''`will match no methods. Currently, passing no method defaults to `'*'`.

Along with the indexed shortcut parameters, named configuration can also be passed using key value pairs:

```
[
    'path' => '/foo',
    'defaults' => ['action' => 'bar', 'controller' => 'FooController'],
    'methods' => ['get', 'post']
]

```

Parameters and named values can be mixed, although the first 3 indexed items will always to be presumed to be the parameters as ordered above.

Child Routes
============

[](#child-routes)

Child routes can be simply defined in the `children` key of the configuration of the parent route:

```
'dash' => [
    'routes' => [
        'user' => ['/user', ['action' => 'index', 'controller' => 'UserController'], 'children' => [
            'create' => ['/create', ['action' => 'create'], ['get', 'post']],
            'edit' => ['/edit/:id', ['action' => 'edit'], ['get', 'post'], 'constraints' => ['id' => '\d+']],
            'delete' => ['/delete/:id', ['action' => 'delete'], 'get', 'constraints' => ['id' => '\d+']],
        ]],
    ],
],

```

Route Types
===========

[](#route-types)

The router no longer has mulitple route types, instead the `Generic` route handles all aspects of HTTP routing. Instead of specificing the route type in the configuration, the router now knows how to handle all routes based solely on the configuration.

For example, if you want a given route only to match a specific hostname, simply define the correct key value pair in that route's configuration:

```
'user' => ['/user', ['action' => index', 'controller' => 'UserController'], 'get', 'hostname' => 'login.example.com']

```

Similarly, if a given route should only match the https protocol:

```
'user' => ['/user', ['action' => index', 'controller' => 'UserController'], 'get', 'secure' => true]

```

Overloading
===========

[](#overloading)

One confusion that's anticipate to be a minor problem is the confusion of how to overload a given route parameter from within a different module. This is easily achieved by defining the relevant key\\value in the configuration that is intended to override the route. *Overwriting a route parameter by the shortcut key will not take effect because it will only be added to the end of**the configuration array*

```
Module A
'user' => ['/user', ['action' => index', 'controller' => 'UserController'], 'get']

```

```
Module B
'user' => ['path' => '/userinfo']

```

`/user` now will no longer match, but `/userinfo` will match in it's place.

Development
===========

[](#development)

When doing performance-dependent changes, make sure to compare the benchmarks between master and your branch. To run them, execute the following command:

`php vendor/bin/athletic -p benchmark -b vendor/autoload.php`

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 83.3% 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 ~0 days

Total

2

Last Release

3795d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0490627b04e8600f8227138bac3d4aea04c22eecfa119e73b47c362363904847?d=identicon)[DASPRiD](/maintainers/DASPRiD)

---

Top Contributors

[![DASPRiD](https://avatars.githubusercontent.com/u/233300?v=4)](https://github.com/DASPRiD "DASPRiD (105 commits)")[![GeeH](https://avatars.githubusercontent.com/u/613376?v=4)](https://github.com/GeeH "GeeH (13 commits)")[![Ocramius](https://avatars.githubusercontent.com/u/154256?v=4)](https://github.com/Ocramius "Ocramius (5 commits)")[![danizord](https://avatars.githubusercontent.com/u/1850941?v=4)](https://github.com/danizord "danizord (1 commits)")[![samsonasik](https://avatars.githubusercontent.com/u/459648?v=4)](https://github.com/samsonasik "samsonasik (1 commits)")[![sasezaki](https://avatars.githubusercontent.com/u/42755?v=4)](https://github.com/sasezaki "sasezaki (1 commits)")

---

Tags

httppsr-7routing

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/dasprid-dash/health.svg)

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

###  Alternatives

[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

8.0k1.1B3.9k](/packages/guzzlehttp-psr7)[symfony/psr-http-message-bridge

PSR HTTP message bridge

1.3k320.9M963](/packages/symfony-psr-http-message-bridge)[league/uri-interfaces

Common tools for parsing and resolving RFC3987/RFC3986 URI

539238.7M44](/packages/league-uri-interfaces)[mezzio/mezzio

PSR-15 Middleware Microframework

3923.8M124](/packages/mezzio-mezzio)[laminas/laminas-stratigility

PSR-7 middleware foundation for building and dispatching middleware pipelines

587.2M99](/packages/laminas-laminas-stratigility)[laudis/neo4j-php-client

Neo4j-PHP-Client is the most advanced PHP Client for Neo4j

185702.8k42](/packages/laudis-neo4j-php-client)

PHPackages © 2026

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