PHP code example of kingbes / attribute

1. Go to this page and download the library: Download kingbes/attribute library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kingbes / attribute example snippets


use Kingbes\Attribute\Data; //引入

Data::$data // 获取全部注解信息

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());
    }
}