国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

PHP8注解插件

1.0.0 版本
2024-01-13 版本更新時(shí)間
30 安裝
4 star

更多內(nèi)容請(qǐng)進(jìn)入GitHub

Attribute

?? ?? ?? 基于webman使用 KingBes/Attribute 包實(shí)現(xiàn)的注解路由,中間件,權(quán)限標(biāo)識(shí),視圖標(biāo)識(shí)等解決方案

PHP8的注解方案

更新日志

安裝

composer require kingbes/attribute

使用,建議結(jié)合php8的命名參數(shù)使用

use Kingbes\Attribute\Annotation; //引入

#[Annotation(
    title: "首頁(yè)的",
    add: ["classnew" => "class新增一個(gè)"]
)]
class IndexController
{
    #[Annotation(
        title: "首頁(yè)",
        path: ["/index", "/", "/home"],
        request: ["get", "post"],
        auth: true,
        add: ["newfun" => "方法新增一個(gè)"]
    )]
    public function index(Request $request)
    {
        return json(Annotation::data());
    }
}

其中:return json(Annotation::data()); 得到結(jié)果

[
    {
        "title": "首頁(yè)的", // 默認(rèn):無(wú)Controller后綴的短class名
        "class": "\\app\\controller\\IndexController", // class
        "auth": false, // 權(quán)限標(biāo)識(shí) 默認(rèn): false
        "methods": [ // 方法數(shù)組
            {
                "title": "首頁(yè)", // 默認(rèn):method名
                "path": [ // 路由路徑組 默認(rèn):/無(wú)Controller后綴的短class名/method名  比如:/index/home
                    "/index",
                    "/",
                    "/home"
                ],
                "request": [ // 可請(qǐng)求方式 默認(rèn): ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS']
                    "get",
                    "post"
                ],
                "middleware": [], // 中間件
                "auth": true, // 權(quán)限標(biāo)識(shí)
                "view": false, // 視圖標(biāo)識(shí)
                "name": "index.index", // 路由名 默認(rèn):無(wú)Controller后綴的短class名.method名  比如: index.index
                "method": "index", // method名
                "newfun": "方法新增一個(gè)" // 新增數(shù)據(jù) 默認(rèn):不存在
            }
        ],
        "classnew": "class新增一個(gè)" // 新增數(shù)據(jù) 默認(rèn):不存在
    }
]

class中僅title、add、auth有效

贊助商