Download the PHP package bybzmt/router without Composer
On this page you can find all versions of the php package bybzmt/router. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bybzmt/router
More information about bybzmt/router
Files in bybzmt/router
Package router
Short Description a fast php router
License Apache-2.0
Homepage http://github.com/bybzmt/router.php
Informations about the package router
Bybzmt/Router
A simple and fast PHP Router
Features
- Static Route Patterns
- Dynamic Route Patterns
- Supports
GET
,POST
,PUT
,DELETE
,OPTIONS
,PATCH
andHEAD
request methods - Supports
X-HTTP-Method-Override
header - Allowance of
:Class.Method
calls - Custom 404 handling
- Reverse Router
Prerequisites/Requirements
- PHP 5.3 or greater
- URL Rewriting
Installation
Installation is possible using Composer
Usage
Routing
using $router->handle(method(s), pattern, function):
Shorthands for single request methods are provided:
Route Patterns
- Static Route Patterns are essentially URIs, e.g.
/about
- Dynamic Route Patterns are Perl-compatible regular expressions (PCRE) that resemble URIs, e.g.
/movies/(\d+)
The subpatterns defined in Dynamic Route Patterns are converted to parameters which are passed into the route handling function. Prerequisite is that these subpatterns need to be defined as parenthesized subpatterns, which means that they should be wrapped between parens:
:Class.Method calls
We can route to the class action like so:
Custom 404
Override the default 404 handler using $router->set404(function);
Reverse Router
Cache Data
Storage Data (file1.php)
Recovery Data (file2.php)
Thanks
Licence
Apache-2.0