Download the PHP package caichuanhai/router without Composer

On this page you can find all versions of the php package caichuanhai/router. 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 router

Router

关于

完全自己开发的路由类库,不依赖任何第三方类库,开箱即用,仿部分Laravel路由功能,后期将加入路由缓存功能。

安装

  1. composer安装

  2. 普通安装 下载:[https://github.com/caichuanhai/Router](https://github.com/caichuanhai/Router)src/Router.php放入自己项目任意目录中。

使用

调用时可使用两种方式:

表示匹配 a/b/后面接数字的URL,等同于:

如果访问a/b/1/2/3,则表示运行a控制器bpost方法,并用传参2和3,等同于:

如果访问a/b/c则不会匹配到该路由。

表示将该路由命名为profile,在其他地方如果我们想直接加载该路由方法时,可使用:

直接运行UserController@showProfile,后面的$param可选,表示传递到该方法的参数数组。

路由前缀

prefix 方法可以用来为分组中每个路由添加一个给定 URI 前缀,例如,你可以为分组中所有路由 URI 添加 admin 前缀 :

这样我们就可以通过 http://blog.test/admin/users 访问路由了。

路由名称前缀

name 方法可通过传入字符串为分组中的每个路由名称设置前缀,例如,你可能想要在所有分组路由的名称前添加 admin 前缀,由于给定字符串和指定路由名称前缀字符串完全一样,所以需要在前缀字符串末尾后加上 . 字符:

若在其他地方需要直接访问404路由,可使用:

其中$conpath为项目控制器所在路径,必须要填,不然Router不知道控制器放哪,也就无法检测控制器是否存在。

注:代码中已经实现了中间件的设置,但中间件功能的执行还未完成,所以些功能暂时不可用,将在后续版本中完善。


All versions of router with dependencies

PHP Build Version
Package Version
No informations.
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 caichuanhai/router contains the following files

Loading the files please wait ....