Download the PHP package hyperf-plus/route without Composer

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

HPlus Route - 智能RESTful路由组件

PHP Version Hyperf Version

一个为 Hyperf 框架打造的智能路由组件,支持 RESTful 规范自动路径生成、资源子操作映射、智能参数识别等高级特性。

✨ 核心特性

📦 安装

由于该版本改动较大,按照最新 restful规范,不向下兼容,如果老用户请勿升级,老模式会继续稳定跟进

🚀 快速开始

1. 基础使用

2. 资源子操作

3. 智能参数识别

4. 自定义路径

📋 RESTful 映射规则

标准 CRUD 操作

方法名 HTTP动词 自动路径 说明
index/list GET / 获取列表
show/detail GET /{id} 获取详情
create/store POST / 创建资源
update/edit PUT /{id} 更新资源
patch PATCH /{id} 部分更新
delete/destroy DELETE /{id} 删除资源

扩展操作

方法名 HTTP动词 自动路径 说明
search GET /search 搜索
export GET /export 导出
import POST /import 导入
batch POST /batch 批量操作

资源子操作

方法名 HTTP动词 自动路径 说明
state/status GET /{id}/state 获取状态
enable/disable POST /{id}/enable 启用/禁用
lock/unlock POST /{id}/lock 锁定/解锁
permissions GET /{id}/permissions 获取权限
history GET /{id}/history 获取历史

🎯 注解说明

@ApiController

控制器注解,标记一个类为 API 控制器。

@GetApi / @PostApi / @PutApi / @DeleteApi / @PatchApi

方法注解,定义 HTTP 路由。

参数注解

🛠️ 高级用法

1. 路由收集器

2. 版本控制

3. 路由分组

⚡ 性能优化

性能数据:

🔧 配置

config/autoload/annotations.php 中配置:

🤝 与其他组件集成

与 HPlus Validate 集成

与 HPlus Swagger 集成

路由组件会自动被 Swagger 组件识别,生成 API 文档。

📝 最佳实践

  1. 命名约定

    • 控制器:单数名词 + Controller(如 UserController
    • RESTful 方法:使用标准名称(index, show, create, update, delete)
    • 扩展方法:使用描述性名称(search, export, batch)
  2. 路径设计

    • 优先使用自动生成,保持一致性
    • 复杂场景才手动指定路径
    • 遵循 RESTful 设计原则
  3. 安全考虑
    • 默认所有方法都需要路由注解才能访问
    • 敏感操作添加 security: true
    • 合理使用中间件

🐛 问题排查

  1. 路由未生成

    • 检查是否添加了路由注解
    • 确认控制器有 @ApiController 注解
    • 验证注解是否正确导入
  2. 路径不符合预期
    • 查看路由统计了解生成规则
    • 使用 path 参数自定义路径
    • 检查方法名是否符合映射规则

📄 许可证

MIT License

🤝 贡献

欢迎提交 Issue 和 Pull Request!


All versions of route with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
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 hyperf-plus/route contains the following files

Loading the files please wait ....