PHPackages                             meraki/http-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. meraki/http-router

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

meraki/http-router
==================

Maps HTTP requests to HTTP responses in PHP 8+.

0.8.0(3y ago)3274[17 issues](https://github.com/merakiframework/http-router/issues)MITPHPPHP ^8

Since Dec 30Pushed 3y ago1 watchersCompare

[ Source](https://github.com/merakiframework/http-router)[ Packagist](https://packagist.org/packages/meraki/http-router)[ RSS](/packages/meraki-http-router/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (17)Versions (2)Used By (0)

http-router
===========

[](#http-router)

Maps HTTP requests to HTTP responses in PHP 8+.

Features
--------

[](#features)

- root path "/" mappings
- configure root path sub-namespace
- GET http method
- POST http method
- PUT http method
- DELETE http method
- OPTIONS http method
- return GET request-handler if no HEAD request-handler is defined
- asterix OPTIONS "OPTIONS \*" http method
- prevent alternative root path sub-namespace mapping (e.g. "/" is also available at "/home")
- configure action prefix
- configure action suffix
- noun-based URLs (plural) (RESTful URLs)
- verb-based URLs (singular) (actions)
- override plural segments (exclude words from auto plural-singular conversion)
- override singular segments (exclude words from auto singular-plural conversion)
- support HEAD request from a GET request handler
- variadic routing (trailing parameters)
- nested resources
- required parameter routing
- optional parameter routing
- integer parameters
- string parameters
- array parameters
- float parameters
- allowed methods provided for 405 results
- accepted types provided for 406 results
- cache results
- logging
- provide custom inflector (for noun-plural conversions)
- provide custom logger
- provide custom negotiator (for negotiating media-types/languages/etc.)
- negotiate media-types
- negotiate languages
- Concurrency support for Swoole
- Reverse routing
- Remove the need on having to define parent resource classes (caveat 1)
- route dumper (CLI)
- class creator from route (CLI)
- Enum support?
- value-object support?
- Better differentiation between when a plural or noun is needed (so overriding plural words are not needed as much)
- union types (int|string)

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

[](#installation)

```
composer install meraki/http-router

```

Usage
-----

[](#usage)

Basic configuration that will suit most small projects and that is compatible with all the PHP-FIG PSRs:

```
