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.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
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
Requires php Version ^8.2
next/http-message Version ~0.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package next/routing contains the following files

Loading the files please wait ....