PHPackages                             hybridlogic/router - 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. hybridlogic/router

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

hybridlogic/router
==================

A drop dead simple URI routing library for PHP, with support for optional parameters and regular expressions.

v1.0.2(13y ago)1262MITPHPPHP &gt;=5.3.0

Since Jan 2Pushed 13y ago6 watchersCompare

[ Source](https://github.com/Dachande663/PHP-Router)[ Packagist](https://packagist.org/packages/hybridlogic/router)[ Docs](https://github.com/Dachande663/PHP-Router)[ RSS](/packages/hybridlogic-router/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (4)Used By (0)

Router
======

[](#router)

A drop dead simple URI routing library for PHP, with support for optional parameters and regular expressions.

[![Build Status](https://camo.githubusercontent.com/c520a18d5aac33ad1871afb3249f4958d3306fa74b0194fec33996352a580baf/68747470733a2f2f7472617669732d63692e6f72672f44616368616e64653636332f5048502d526f757465722e706e67)](https://travis-ci.org/Dachande663/PHP-Router)

0.0 Table of Contents
---------------------

[](#00-table-of-contents)

- Introduction
- Examples
- Format
- Running Tests
- Troubleshooting
- Changelog

1.0 Introduction
----------------

[](#10-introduction)

Router is a very simple URI request routing library, designed for providing a simple front controller for applications. A request is run against a dictionary of routes, and the first one to match is executed.

It supports expansions for common expressions (numeric, slugs etc), along with full regexes and optional parameter support.

Can be used in front of a full MVC stack, or with simple in-place closures.

2.0 Examples
------------

[](#20-examples)

```
$router = new \HybridLogic\Router;

$router->get('about', function(){
	echo 'About Us';
});

$router->run();
```

3.0 Format
----------

[](#30-format)

Each route you wish to match should have a rule. The rule shouldn't include a beginning or ending slash, except for the homepage, which is just /.

When defining a route, you can specify which HTTP methods it should respond to (GET, POST etc). For example, to only allow GET requests, use -&gt;get(...). A utility method for quickly adding GET and POST is provided via -&gt;any(...).

A route pattern matches a request exactly, that means sub- directories are not included, for example "about" would match /about, but not /about-us or /about/john-smith.

There are three default regex expressions provided:

- **:num** Matches any numeric value (\[0-9\]+)
- **:any** Matches alphanumeric values, including - and \_ (\[a-z0-9-\_\]+)
- **:all** Matches anything, including slashes, will override anything after it

You can also provide your own regex, e.g.

```
/about/:[a-z][a-z0-9]+

```

To make a section optional, simply put a question mark (?) at the end, e.g.

```
/about/:any?

```

Example patterns:

PatternMatchesDescription//Homepageabout/aboutMatches optional trailing slashabout/:any?/about/johnMatch optional directoriesarchive/:num/:num?/archive/2012/06Match archive pattern:all/matches/anythingCatch-all handler (404s)4.0 Running Tests
-----------------

[](#40-running-tests)

phpunit tests

5.0 Troubleshooting
-------------------

[](#50-troubleshooting)

Nothing here yet.

6.0 Changelog
-------------

[](#60-changelog)

- **\[2012-12-17\]** Initial Version
- **\[2012-12-18\]** Removed 404 handler
- **\[2012-12-19\]** Add any() and all() methods.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

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 ~5 days

Total

3

Last Release

4874d ago

### Community

Maintainers

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

---

Top Contributors

[![Dachande663](https://avatars.githubusercontent.com/u/106847?v=4)](https://github.com/Dachande663 "Dachande663 (12 commits)")

---

Tags

requesturirouter

### Embed Badge

![Health badge](/badges/hybridlogic-router/health.svg)

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

###  Alternatives

[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

7.9k1.0B3.2k](/packages/guzzlehttp-psr7)[symfony/routing

Maps an HTTP request to a set of configuration variables

7.6k789.4M1.8k](/packages/symfony-routing)[fsasvari/laravel-trailing-slash

The package that adds redirection with trailing slash to Laravel framework.

63164.3k](/packages/fsasvari-laravel-trailing-slash)[pdeans/http

PSR-7 cURL HTTP client with support for PSR-17 HTTP factories.

1466.2k3](/packages/pdeans-http)[workerman/psr7

PSR-7 message implementation that also provides common utility methods

1079.8k10](/packages/workerman-psr7)[northwoods/router

Fast router for PSR-15 request handlers

161.4k](/packages/northwoods-router)

PHPackages © 2026

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