Download the PHP package redcatphp/route without Composer
On this page you can find all versions of the php package redcatphp/route. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download redcatphp/route
More information about redcatphp/route
Files in redcatphp/route
Package route
Short Description Route - A mirco-framework for manage entry point of applications
License LGPL-3.0+ CC0-1.0
Homepage http://redcatphp.com/route-url
Informations about the package route
No longer actively maintained. I work now with NodeJS and I recommand you to take a look at express
Route your application's requests
Route is a micro-framework designed for manage requests with flexibility and simplicity.
FrontController
This is a basic front-controller class which you can extends to build the front map of your application. It's build with a router that will solve the request. Is implementing the ArrayAccess interface and runFromGlobals method which is used in the generic RedCat's index.php.
Extending:
And then, use it:
Append and prepend methods:
Z-index like api in third parameter (default is zero)
It will look first for ".stuff" matching, then "test/more", and finally "test/":
Parameters automatic wrap:
Empty url handling:
Lazy loading match, array containing first element starting with "new:", the object will be instantiated only if is necessary (previous didn't match):
Lazy loading callback, array containing first element or string starting with "new:", the object will be instantiated only if is necessary (matching):
Run
Router
The router is the component which is used by FrontController to map, append and prepend pair of match to behaviour. It support the methods explained before in FrontController except runFromGlobals.
Match
The basic match components are distributed under the RedCat\Route\Match namespace but there is also some examples of specific match in the RedCat\Plugin\RouteMatch namespace. The only rule to make a Match object is that he have to be callable implementing __invoke magic method. You can also use php Closure also called anonymous function.
Url
Url is a tiny helper for extract some simple components from Url.