Download the PHP package dframe/router without Composer
On this page you can find all versions of the php package dframe/router. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dframe/router
More information about dframe/router
Files in dframe/router
Package router
Short Description Router component Dframe
License MIT
Homepage https://dframeframework.com/en/docs/dframe/master/router/overview
Informations about the package router
Dframe/Router - Component
Documentation - Router PHP
Composer
Simple PHP Router
Creating an application, it's worth taking care of their friendly links. Its has a big part in position in SEO. Link router work in a similar way as network router. It is responsible for calling the method from controller.
Configuration
We define the table with adresses for our application in the configuration file
- |https| - true/false forcing https
- |NAME_CONTROLLER| - Name of the default controller
- |NAME_METHOD| - Name of the default method from the controller in NAME_CONTROLLER
- |publicWeb| - Main folder from which files will be read (js, css)
-
|assetsPath| - Dynamic folder
- |docs/docsId| - Example routing with the |docsId| variable, which contains the |docs/[docsId]/| adress definition and the |task| parameters to which it's assigned.
- |error/404| - as above
- |default| - default definition loading the controller/method. |params| defines the possibility of additional parameters appearing, while
`
defines the way the additional foo=bar parameters should be interpreted.
Config/router.php
Controller
- makeUrl - is used for generating the full adress. For example |makeurl| - method used for redirections, equivalent of |header| but with a parameter being a key from the Config/router.php table. In case of using docs/:docsld it looks as the following |redirect|
Controller/Page.php
View
assign - it's a method of the template engine that assignes value to a variable which is used in the template files.
View/templates/index.html.php
Using only PHP
- |router| all already available methods used like in |page/index|
View/index.php
Dframe\Router\Response;
Extention of the basic Dframe\Router is Dframe\Router\Response, adding functionality of setting the response status (404, 500, etc.) and their headers.
For generating html.
Render json
Render json with callback
Redirect
All versions of router with dependencies
ext-json Version *