PHPackages                             siro/routify - 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. siro/routify

ActiveLibrary

siro/routify
============

Simple router based on Express router

07PHP

Since Aug 10Pushed 9y ago1 watchersCompare

[ Source](https://github.com/SiroDiaz/Routify)[ Packagist](https://packagist.org/packages/siro/routify)[ RSS](/packages/siro-routify/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Routify
=======

[](#routify)

[![Build Status](https://camo.githubusercontent.com/bbd85ab92d9189b98806d32ef01123b2f0781a76ebd6b8d17bc4ed03ab0ee553/68747470733a2f2f7472617669732d63692e6f72672f5369726f4469617a2f526f75746966792e737667)](https://travis-ci.org/SiroDiaz/Routify)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/006a6fec869cf7b9b8a8f5bc9826e669ed0c7aa37501d485a6a1099038237c41/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f5369726f4469617a2f526f75746966792f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/SiroDiaz/Routify/?branch=master)

A simple PHP router inspired in Express framework.

Routify is a fast and flexible router for PHP 5.4 and higher.

- Flexible regular expression routing (inspired by Express)
- Concrete use. Focused in do well one thing
- Easy to learn. Simple API that will remember you Express or Slim

### Getting started

[](#getting-started)

1. PHP 5.4.x is required
2. Install Routify using Composer (recommended) or manually
3. Setup URL rewriting so that all requests are handled by index.php, for example, using an .htaccess file

### Example

[](#example)

```
require 'vendor/autoload.php';

$router = new Routify\Router();

$middleware1 = function() {
    echo "middleware 1";
};

$middleware2 = function() {
    echo "middleware 2";
};

$router->get('/', function() {
        echo "This is an action";
    },
    ['before' => $middleware1, 'after' => $middleware2]
);

$router->get('/post/:slug/:id', function($slug, $id) {
	echo "You are seeing the post nº $id, with title: $slug";
});

$router->post('/new', function() {
	// something for the POST /new
});

$router->put('/', function() {
	// something for the PUT /
});

$router->delete('/:id', function($id) {
	// something for the DELETE /:id
});

$router->both('/hello/world', function() {
    // something for GET and POST requests
}, ['GET', 'POST']);

$router->any('/bye', function() {
    // something for any request method
}, ['before' => $middleware1, 'after' => $middleware2]);

// regular expression route
$router->get('/(login|logout), function() {
    // response for the login or logout route requested
});

$router->run();
```

### Tests and submit code

[](#tests-and-submit-code)

New features or modifications must be tested with **PHPUnit** previously to pull requests of new code.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7469286?v=4)[Siro Díaz Palazón](/maintainers/SiroDiaz)[@SiroDiaz](https://github.com/SiroDiaz)

---

Top Contributors

[![SiroDiaz](https://avatars.githubusercontent.com/u/7469286?v=4)](https://github.com/SiroDiaz "SiroDiaz (43 commits)")

---

Tags

phpphp-routerrouterroutify

### Embed Badge

![Health badge](/badges/siro-routify/health.svg)

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

PHPackages © 2026

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