PHPackages                             tandrezone/zroute - 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. tandrezone/zroute

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

tandrezone/zroute
=================

A simple, lightweight PHP routing system

v2.0.0(1mo ago)07[1 issues](https://github.com/tandrezone/zRoute/issues)[1 PRs](https://github.com/tandrezone/zRoute/pulls)MITPHPPHP &gt;=8.0

Since Apr 28Pushed 2mo agoCompare

[ Source](https://github.com/tandrezone/zRoute)[ Packagist](https://packagist.org/packages/tandrezone/zroute)[ RSS](/packages/tandrezone-zroute/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (2)Dependencies (2)Versions (6)Used By (0)

zRoute
======

[](#zroute)

A simple, lightweight PHP routing system available as a Composer package.

Features
--------

[](#features)

- **Static routes** – `/about`, `/contact`, `/api/v1/status`
- **Dynamic routes** – `/products/$product-slug`, `/users/$id`, `/users/{id}/posts/{postId}`
- **Dual parameter syntax** – legacy `$param` or curly-brace `{param}` (both fully supported)
- **Per-parameter regex constraints** – e.g. `{id}` constrained to `[0-9]+`
- **Array-based route loading** – define routes as plain PHP arrays via `loadFromArray()` / `loadFromFile()`
- **Named routes** – look up any registered route by its logical name
- **Middleware pipeline** – sequential PSR-like middleware execution before the handler
- **Parameter validation** – type-casting, required/optional checks, default values, structured arrays
- **Config-driven paths** – resolve paths from a config array at load time (`config[namespace.key]`)
- All common HTTP methods: `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, and `any()`
- Fluent (chainable) API
- Customisable 404 (Not Found) and 405 (Method Not Allowed) handlers
- Path normalisation: trailing slashes, query strings, and dot-segments (`.`, `..`) are handled automatically

---

Requirements
------------

[](#requirements)

- PHP 8.0 or higher

---

Installation
------------

[](#installation)

```
composer require tandrezone/zroute
```

---

Quick Start
-----------

[](#quick-start)

```
