PHPackages                             monolyth/reroute - 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. [Framework](/categories/framework)
4. /
5. monolyth/reroute

ActiveLibrary[Framework](/categories/framework)

monolyth/reroute
================

Extremely flexible router for the Monolyth unframework

5.3.3(1y ago)1675[1 PRs](https://github.com/monolyth-php/reroute/pulls)1MITPHPPHP &gt;=8.1

Since Jan 16Pushed 1y ago1 watchersCompare

[ Source](https://github.com/monolyth-php/reroute)[ Packagist](https://packagist.org/packages/monolyth/reroute)[ RSS](/packages/monolyth-reroute/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (7)Versions (88)Used By (1)

Reroute
=======

[](#reroute)

Flexible PHP5 HTTP router, with support for various types of URL matching, URL arguments, custom state handling and URL generation. Reroute is designed to be usable in any type of project or framework.

- [Homepage](http://monolyth.monomelodies.nl/reroute/)
- [Documentation](http://monolyth.monomelodies.nl/reroute/docs/)

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

[](#installation)

### Composer (recommended)

[](#composer-recommended)

```
$ composer require monolyth/reroute
```

### Manual installation

[](#manual-installation)

1. Get the code;
    1. Clone the repository, e.g. from GitHub;
    2. Download the ZIP (e.g. from Github) and extract.
2. Make your project recognize Reroute:
    1. Register `/path/to/reroute/src` for the namespace `Monolyth\\Reroute\\`in your PSR-4 autoloader (recommended);
    2. Alternatively, manually `include` the files you need.

Basic Usage
-----------

[](#basic-usage)

### Responding to requested URLs

[](#responding-to-requested-urls)

Since the Reroute router responds to HTTP requests, we use the `when` method to define a valid URL:

```
