PHPackages                             hunomina/http-router-php - 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. hunomina/http-router-php

ActiveLibrary

hunomina/http-router-php
========================

Implementation of Http Router classes for PHP7.1 or higher

1.3.2(7y ago)01951proprietaryPHPPHP ^7.1

Since Oct 15Pushed 7y ago1 watchersCompare

[ Source](https://github.com/hunomina/http-router-php)[ Packagist](https://packagist.org/packages/hunomina/http-router-php)[ RSS](/packages/hunomina-http-router-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (13)Used By (1)

Http Router PHP
===============

[](#http-router-php)

[![Build Status](https://camo.githubusercontent.com/6ff5112bce973b714809eb5b8cc44f20d7bc45fe145945d71801a873acacb270/68747470733a2f2f7472617669732d63692e636f6d2f68756e6f6d696e612f687474702d726f757465722d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/hunomina/http-router-php)

Description : Implementation of Http Router classes for PHP7.1 or higher.

This library is mainly composed of 4 classes.

Router
------

[](#router)

The *[Router](https://github.com/hunomina/http-router-php/blob/master/src/Routing/Router.php)* class handles request by calling the *request(string $method, string $url)* method which must return a route action response.

Can be instantiate by passing a route file and a type (json, yaml... extend if you want to add new ones).

The Router::request(*$method*, *$url*) method allows to execute a route action based on the method and the url parameters.

Example of route files [here](https://github.com/hunomina/http-router-php/tree/master/tests).

RouteManager
------------

[](#routemanager)

The *[RouteManager](https://github.com/hunomina/http-router-php/blob/master/src/Routing/RouteManager/RouteManager.php)* parses route files. You can then get Route objects by calling the *getRoutes()* method.

This class is *abstract*, so you have to extend it in order to add new route file types (See *[JsonRouteManager](https://github.com/hunomina/http-router-php/blob/master/src/Routing/RouteManager/JsonRouteManager.php)* or *[YamlRouteManager](https://github.com/hunomina/http-router-php/blob/master/src/Routing/RouteManager/YamlRouteManager.php)* for examples).

Route
-----

[](#route)

A *[Route](https://github.com/hunomina/http-router-php/blob/master/src/Routing/Route.php)* object is composed of these attributes :

- *array* $\_methods : An array of HTTP methods handled by the route
- *string* $\_url : The url of the route
- *string* $\_pattern : A regexp representing the urls handled by the route
- *array* $\_action : A two items array. The first is the FQN of a class (namespaces separated by ':'). The second one is the name of the method you want to call for this route. When setting the action attribute you have to pass a string which respects this syntax classname::method.

Finally, the Route::call() method execute the route action which has to return a [Response](https://github.com/hunomina/http-router-php/blob/master/src/Http/Response/Response.php) object.

Response
--------

[](#response)

A *[Response](https://github.com/hunomina/http-router-php/blob/master/src/Http/Response/Response.php)* object is composed of :

- *array* $\_headers : An array of HTTP headers
- *string* $\_content : Content of the response

The class is *abstract*, so you have to extend in order to add new response types

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~14 days

Recently: every ~3 days

Total

12

Last Release

2605d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/37975d851f2946e4fab563ba4558e2b81908d933a4a550da65d1ac8a15a207e0?d=identicon)[hunomina972](/maintainers/hunomina972)

---

Top Contributors

[![hunomina](https://avatars.githubusercontent.com/u/16224681?v=4)](https://github.com/hunomina "hunomina (44 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hunomina-http-router-php/health.svg)

```
[![Health](https://phpackages.com/badges/hunomina-http-router-php/health.svg)](https://phpackages.com/packages/hunomina-http-router-php)
```

###  Alternatives

[getkirby/cms

The Kirby core

1.5k535.5k350](/packages/getkirby-cms)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M385](/packages/shopware-core)[neos/flow

Flow Application Framework

862.0M448](/packages/neos-flow)[rock-symphony/rock-symphony

Fork of symfony 1.4 with dic, form enhancements, latest swiftmailer and better performance

19164.1k3](/packages/rock-symphony-rock-symphony)

PHPackages © 2026

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