Download the PHP package next/routing without Composer
On this page you can find all versions of the php package next/routing. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Vendor next
Package routing
Short Description A lightweight and fast routing component.
License Apache-2.0
Homepage https://github.com/next-laboratory/routing
Package routing
Short Description A lightweight and fast routing component.
License Apache-2.0
Homepage https://github.com/next-laboratory/routing
Please rate this library. Is it a good library?
Informations about the package routing
一款简单的路由
初始化
如果传递给Router类的路由收集器是null,则内部会自动实例化
使用
支持GET, POST, PUT, PATCH, DELETE等方法,例如:
如果需要一个路由注册自定义请求方法,例如:
如果需要一个路由支持所有请求方法,例如:
路由支持参数,例如:
路由支持分组并且支持分组嵌套,例如:
上面的规则定义两条路由规则,第一条请求方式为GET,path为/api
的路由规则,且中间件包含Authentication
,第二条相相对于第一条还加了参数类型限制,此时id参数只能是数字
分组路由前置方法支持
prefix
,namespace
,middleware
,where
等
对于分组路由,你还可以在闭包中通过引入文件的方式来注册,例如:
在文件中的路由均使用$router来注册
解析路由
解析路由使用路由收集器来完成,如果你没有使用外部,则可以使用Router对象提供的方法获取
解析方法有两个
解析完成后会返回一个匹配到的路由的克隆对象,该对象中保存的对应变量,如果没有匹配到,则会抛出相应异常
All versions of routing with dependencies
PHP Build Version
Package Version
The package next/routing contains the following files
Loading the files please wait ....