PHPackages                             oihana/php-routes - 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. oihana/php-routes

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

oihana/php-routes
=================

The Oihana PHP Routes library

1.1.0(3w ago)03241MPL-2.0PHP &gt;=8.4

Since Jun 21Compare

[ Source](https://github.com/BcommeBois/oihana-php-routes)[ Packagist](https://packagist.org/packages/oihana/php-routes)[ Docs](https://github.com/BcommeBois/oihana-php-routes)[ RSS](/packages/oihana-php-routes/feed)WikiDiscussions Synced 2w ago

READMEChangelogDependencies (12)Versions (3)Used By (1)

Oihana PHP - Routes
===================

[](#oihana-php---routes)

[![Oihana PHP Routes](https://raw.githubusercontent.com/BcommeBois/oihana-php-routes/main/assets/images/oihana-php-routes-logo-inline-512x160.png)](https://raw.githubusercontent.com/BcommeBois/oihana-php-routes/main/assets/images/oihana-php-routes-logo-inline-512x160.png)

Declarative, composable HTTP route definitions for PHP 8.4+, built on [Slim](https://www.slimframework.com/).

[![Latest Version](https://camo.githubusercontent.com/18f363061cdde080db71b89e7efe15a773c9ebafbad73f5011e746863ff698fd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f6968616e612f7068702d726f757465732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oihana/php-routes)
[![Total Downloads](https://camo.githubusercontent.com/64e439b4cb3264545e1bf0a9488ac0c75879567e984a59cea019ed43809d0cff/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f6968616e612f7068702d726f757465732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oihana/php-routes)
[![License](https://camo.githubusercontent.com/954658555ad2b4f653020dd226267ab476a117d53ae353d75235cec367f88c96/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6f6968616e612f7068702d726f757465732e7376673f7374796c653d666c61742d737175617265)](LICENSE)

📚 Documentation
---------------

[](#-documentation)

User guides (FR + EN), with narrative explanations and examples:

🇬🇧 **[English documentation](wiki/en/README.md)**🇫🇷 **[Documentation française](wiki/fr/README.md)**Getting started, routes, HTTP method routes, document &amp; i18n routes, helpers, testing.Démarrage, routes, routes par méthode HTTP, routes document &amp; i18n, helpers, tests.Auto-generated API reference (phpDocumentor):
👉

🧠 What is it?
-------------

[](#-what-is-it)

`oihana/php-routes` provides a small, declarative layer for defining HTTP routes on top of Slim: a composable `Route` base, one class per HTTP verb (`GetRoute`, `PostRoute`, …), higher-level `DocumentRoute` / `I18nRoute`, and helpers to register them on a Slim app from a PSR-11 container. Each route maps a URL pattern to a controller method.

```
use DI\Container;
use Slim\Factory\AppFactory;
use Slim\App;

use oihana\routes\http\GetRoute;

$container = new Container();
AppFactory::setContainer( $container );
$app = AppFactory::create();
$container->set( App::class , $app );

// Register: GET /api/test  ->  $controller->get()
$route = new GetRoute( $container , [
    'controllerID' => 'my.controller',
    'route'        => 'api/test',
] );

$route(); // registers the route on the Slim app
```

For full details (route classes, flags, helpers), see the table of contents in the [documentation](wiki/en/README.md).

🚀 Features
----------

[](#-features)

- 🧭 A composable `Route` base and per-verb route classes — `GetRoute`, `PostRoute`, `PutRoute`, `PatchRoute`, `DeleteRoute`, `DeleteAllRoute`, `OptionsRoute`, `ListRoute`.
- 📄 Higher-level routes — `DocumentRoute` and `I18nRoute` for documents and localized paths.
- 🚩 Declarative route options via the `RouteFlag` bit flags.
- 🧩 Route registration helpers — `HttpMethodRoutesTrait`, `HasRouteTrait`, plus `withPlaceholder()` and `responsePassthrough()`.
- 🔗 Built on Slim and wired through a PSR-11 container.
- 🧪 Full unit-test coverage ensuring reliability and maintainability.

💡 Designed to be composable, testable, and compatible with any PHP 8.4+ project.

📦 Installation
--------------

[](#-installation)

> **Requires [PHP 8.4+](https://php.net/releases/)**

Install via [Composer](https://getcomposer.org):

```
composer require oihana/php-routes
```

> `oihana/php-routes` depends on [`oihana/php-controllers`](https://github.com/BcommeBois/oihana-php-controllers), which requires the **`ext-imagick`** extension — make sure it is installed.

✅ Tests &amp; coverage
----------------------

[](#-tests--coverage)

Run the full unit-test suite (PHPUnit, strict mode):

```
composer test
```

Run a single test case:

```
./vendor/bin/phpunit --filter GetRouteTest
```

Measure coverage (requires Xdebug or PCOV):

```
composer coverage        # text + Clover + HTML under build/coverage/
composer coverage:md     # readable Markdown summary (build/coverage/COVERAGE.md)
```

The suite runs in **strict mode** and targets **100% line coverage**.

🧾 License
---------

[](#-license)

This project is licensed under the [Mozilla Public License 2.0 (MPL-2.0)](https://www.mozilla.org/en-US/MPL/2.0/).

👤 About the author
------------------

[](#-about-the-author)

- Author : Marc ALCARAZ (aka eKameleon)
- Mail :
- Website :

🛠️ Generate the Documentation
-----------------------------

[](#️-generate-the-documentation)

We use [phpDocumentor](https://phpdoc.org/) to generate the documentation into the ./docs folder.

### Usage

[](#usage)

Run the command :

```
composer doc
```

🔗 Related packages
------------------

[](#-related-packages)

- [oihana/php-controllers](https://github.com/BcommeBois/oihana-php-controllers) – the HTTP controllers the routes dispatch to (provides `AppTrait`).
- [oihana/php-core](https://github.com/BcommeBois/oihana-php-core) – core helpers and utilities used by this library.
- [oihana/php-enums](https://github.com/BcommeBois/oihana-php-enums) – strongly-typed constant enumerations (HTTP methods, etc.).

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance95

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

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

Total

2

Last Release

23d ago

### Community

Maintainers

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

---

Tags

httpphprestroutesslimrouting

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/oihana-php-routes/health.svg)

```
[![Health](https://phpackages.com/badges/oihana-php-routes/health.svg)](https://phpackages.com/packages/oihana-php-routes)
```

###  Alternatives

[symfony/symfony

The Symfony PHP framework

31.4k87.4M2.2k](/packages/symfony-symfony)[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

8.0k1.1B4.3k](/packages/guzzlehttp-psr7)[api-platform/core

Build a fully-featured hypermedia or GraphQL API in minutes!

2.6k52.2M366](/packages/api-platform-core)[tempest/framework

The PHP framework that gets out of your way.

2.3k37.6k19](/packages/tempest-framework)[moonshine/moonshine

Laravel administration panel

1.3k268.2k86](/packages/moonshine-moonshine)[api-platform/state

API Platform state interfaces

275.4M156](/packages/api-platform-state)

PHPackages © 2026

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