Download the PHP package hehex/hehep-hrouter without Composer

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

hehep-hroute

介绍

hehep-hroute 是一个PHP 路由工具组件
支持注释注解,PHP8原生注解
支持路由分组
支持key/value结构存储路由,快速定位路由,提高匹配效率
支持合并路由解析,提高匹配效率
支持路由缓存

安装

组件配置

路由配置

路由管理器

路由请求

路由请求类:存储路由解析器需要的数据,比如路由请求对象可以提供pathinfo地址,host,method 等数据
默认路由请求类:
WebRouteRequest:常规web路由请求,比如php+nginx 环境下运行web请求
CliRouteRequest:控制台路由请求,比如php脚本环境下运行脚本请求

路由解释器

路由缓存

路由定义

说明

基本格式:["uri"=>"\<controller:\w+>/\<action:\w+>","action"=>"/","method"=>"get"]
伪代码: Route::get("路由规则","路由地址");
变量参数:格式<变量名>,<变量名:正则表达式> 或{变量名},{变量名:正则表达式},如\<controller:\w+>
uri:路由规则,即匹配http地址的规则表达式
action:路由地址,即匹配"控制器/操作"的表达式,常用于生成url地址
method:请求类型,多个请求类型逗号或|隔开,目前支持以下请求类型
*(任意类型),GET,POST,PUT,DELETE,PATCH,HEAD

常规路由

变量路由

可选变量路由

私有变量路由

默认变量路由

带域名路由

绑定类路由

常用变量表达式

表达式 说明 示例
\w+ 由数字、26个英文字母,下划线 'user/\<action:\w+>'
\d+ 非负整数(正整数 + 0) 'user/\<id:\d+>'
[a-z]+ 26个小写字母 'http://\<lang:[z-z]+>.xxx.cn'
.+,.* 任意字符 'user/get\<param:.+>'
\d{4} 日期格式 news/list/\<year:\d{4}>/\<month:\d{2}>/\<day:\d{2}>
[^\/]+ 匹配除了'/'以外的字符 news/search/\<keyword:[^\/]+>

路由规则参数

参数
说明
方法名 示例
domain 是否域名检测 asDomain asDomain(true)
suffix 生成URL是否加入后缀 asSuffix asSuffix("html")
method 请求类型 asMethod asMethod("get")
id 路由唯一标识 asId asId("news")
params "路由规则"变量集合 asParams asParams(["id"=>"\d+"])
defaults 默认变量集合 asDefaults asDefaults(['lang'=>'en'])
completeMatch 是否完全匹配路由规则,默认完全匹配 asCompleteMatch asCompleteMatch(false)
prule Url参数配置规则 asParamsRule asParamsRule(['pvar'=>'params','class'=>'xxx'])

路由分组

设置规则参数

带变量分组

合并路由解析

分组参数同步子路由

参数 方法 分组路由 子路由 同步至子路由 说明
suffix asSuffix() 统一设置子路由后缀
id asId() 统一设置子路由的id前缀,如分组id:admin::,如子路由id:user,最终子路由id:admin::user
params asParams() 统一设置子路由变量,子路由变量与分组变量合并,并且子路由变量优先
prefix asPrefix("blog/") 统一设置子路由action前缀(首字符为"/"的除外),分组prefix:blog/,子路由action:list,最终子路由action:blog/list
mergeRule asMergeRule(5) ✗; 路由规则合并成一条正则表达式进行验证,可以指定一次合并N条

域名路由

URL参数解析

分隔符(split)格式

PATHINFO分隔格式

Url地址生成

常规生成URL

生成当前访问URL

生成当前访问URL,必须先解析当前路由规则

由路由标识生成URL

生成带后缀URL

生成带域名URL

生成带锚点URL

restful路由

注解路由

扩展路由


All versions of hehep-hrouter with dependencies

PHP Build Version
Package Version
Requires php Version >=7.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 hehex/hehep-hrouter contains the following files

Loading the files please wait ....