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

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

gacela-project/router
=====================

A minimalistic HTTP router.

0.12.1(2y ago)174.2k11MITPHPPHP &gt;=8.1CI passing

Since Apr 10Pushed 5mo ago2 watchersCompare

[ Source](https://github.com/gacela-project/router)[ Packagist](https://packagist.org/packages/gacela-project/router)[ Fund](https://chemaclass.com/sponsor)[ RSS](/packages/gacela-project-router/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (9)Versions (14)Used By (1)

Gacela Router
=============

[](#gacela-router)

A minimalistic HTTP router, ideal for your proof-of-concept projects and decoupled controllers.

 [ ![GitHub Build Status](https://github.com/gacela-project/router/workflows/CI/badge.svg) ](https://github.com/c/actions) [ ![Scrutinizer Code Quality](https://camo.githubusercontent.com/9889ae31fa71eaa2c79eb42a7e99b46c0b108b2461e1b5ba43f326f6ee04cf96/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f676163656c612d70726f6a6563742f726f757465722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d61696e) ](https://scrutinizer-ci.com/g/gacela-project/router/?branch=main) [ ![Scrutinizer Code Coverage](https://camo.githubusercontent.com/5e25f5ab27516e682dadc5830d80b3d97a23852e092a9e706770c78f8eda8dc9/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f676163656c612d70726f6a6563742f726f757465722f6261646765732f636f7665726167652e706e673f623d6d61696e) ](https://scrutinizer-ci.com/g/gacela-project/router/?branch=main) [ ![Psalm Type-coverage Status](https://camo.githubusercontent.com/824d0e420c45f2c187e8ae0134d207d3e10c13ed3df119542da20d9f0630dbf5/68747470733a2f2f73686570686572642e6465762f6769746875622f676163656c612d70726f6a6563742f726f757465722f636f7665726167652e737667) ](https://shepherd.dev/github/gacela-project/router) [ ![Mutation testing badge](https://camo.githubusercontent.com/3e78644fb833606e21bdbdd29c1514210aaf03022d2c7fd812021edcc88acab6/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742675726c3d687474707325334125324625324662616467652d6170692e737472796b65722d6d757461746f722e696f2532466769746875622e636f6d253246676163656c612d70726f6a656374253246726f757465722532466d61696e) ](https://dashboard.stryker-mutator.io/reports/github.com/gacela-project/router/main) [ ![MIT Software License](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667) ](https://github.com/gacela-project/router/blob/master/LICENSE)

### Why?

[](#why)

There are many other routers out there. Eg: using Symfony Framework, Laravel, etc... however, these are really rich in features which means they add a lot of accidental complexity and dependencies to your vendor, that you might want to avoid. At least for your proof-of-concept project.

Gacela Router doesn't aim to be the best router that can do everything, but a light router to have the bare minimum code, ideal for your simple ideas to emerge.

For a POC, we value simplicity over a rich-feature library.

### Installation

[](#installation)

```
composer require gacela-project/router
```

### Example

[](#example)

```
# Request only the parameters you need: Routes, Bindings, Handlers, Middlewares
# All except Routes are optional, and you can place them in any order.

$router = new Router(function (Routes $routes, Bindings $bindings, Handlers $handlers, Middlewares $middlewares) {

    // Custom redirections
    $routes->redirect('docs', 'https://gacela-project.com/');

    // Matching a route coming from a particular or any custom HTTP methods
    $routes->get('custom', CustomController::class, '__invoke');
    $routes->...('custom', CustomController::class, 'customAction');
    $routes->any('custom', CustomController::class);

    // Matching a route coming from multiple HTTP methods
    $routes->match(['GET', 'POST'], '/', CustomController::class);

    // Binding custom dependencies on your controllers
    $routes->get('custom/{number}', CustomControllerWithDependencies::class, 'customAction');
    $bindings->bind(SomeDependencyInterface::class, SomeDependencyConcrete::class)

    // Handle custom Exceptions with class-string|callable
    $handlers->handle(NotFound404Exception::class, NotFound404ExceptionHandler::class);

    // Apply middleware to all routes
    $middlewares->add(new GlobalMiddleware());

    // Use individual middleware to a route
    $routes->get('admin', AdminController::class)->middleware(new AuthMiddleware());

    // Or define a middleware group
    $middlewares->group('web', [
        new SessionMiddleware(),
        new CsrfMiddleware(),
    ]);

    // And apply the group to the route
    $routes->get('/', Controller::class)->middleware('web');

});

$router->run();
```

### Working demo

[](#working-demo)

For a working example run `composer serve` and check the `example/example.php`

> TIP: `composer serve` is equivalent to:
>
> ```
> php -S localhost:8081 example/example.php
> ```

###  Health Score

39

—

LowBetter than 85% of packages

Maintenance51

Moderate activity, may be stable

Popularity29

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 61.8% 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 ~21 days

Recently: every ~59 days

Total

13

Last Release

869d ago

PHP version history (2 changes)0.1.0PHP &gt;=8.0.2

0.12.1PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/3d166420c6770c5941e10bd68b2d26501eabb432e280d8e6eba0a344bcc1e5ae?d=identicon)[Chemaclass](/maintainers/Chemaclass)

![](https://www.gravatar.com/avatar/104da2afcf190e1628dd0cbb29d4f404be41286642d23b51700002d60635ada1?d=identicon)[JesusValeraDev](/maintainers/JesusValeraDev)

---

Top Contributors

[![Chemaclass](https://avatars.githubusercontent.com/u/5256287?v=4)](https://github.com/Chemaclass "Chemaclass (118 commits)")[![antonio-gg-dev](https://avatars.githubusercontent.com/u/13595197?v=4)](https://github.com/antonio-gg-dev "antonio-gg-dev (53 commits)")[![JesusValeraDev](https://avatars.githubusercontent.com/u/6381924?v=4)](https://github.com/JesusValeraDev "JesusValeraDev (13 commits)")[![ynnoig](https://avatars.githubusercontent.com/u/22853912?v=4)](https://github.com/ynnoig "ynnoig (7 commits)")

---

Tags

gacelahttpphprouter

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M317](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[nyholm/psr7

A fast PHP7 implementation of PSR-7

1.3k235.4M2.4k](/packages/nyholm-psr7)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M292](/packages/pusher-pusher-php-server)[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78126.4M414](/packages/react-http)

PHPackages © 2026

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