kingbes / attribute
Webman plugin kingbes/attribute
v1.0.1
2026-04-29 02:47 UTC
Requires
- php: >8.0
README
🚀 🔥 🌈 基于webman使用 KingBes/Attribute 包实现的注解路由,中间件,权限标识,视图标识等解决方案
PHP8的注解方案
更新日志
v1.0.1
获取注解信息
use Kingbes\Attribute\Data; //引入 Data::$data // 获取全部注解信息
安装
composer require kingbes/attribute
使用,建议结合php8的命名参数使用
use Kingbes\Attribute\Annotation; //引入 #[Annotation([ "title": "首页的", ])] class IndexController { #[Annotation([ "title": "首页", "path": ["/index", "/", "/home"], "request": ["get", "post"], "auth": true, ])] public function index(Request $request) { return json(Annotation::data()); } }
request 默认:['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS'] middleware 默认: [] path 默认: [] ,path 为空时,会自动获取类名和方法名作为路由