havocera 17d3d24b6d 提交vendor 1 жил өмнө
..
src 17d3d24b6d 提交vendor 1 жил өмнө
.gitignore 17d3d24b6d 提交vendor 1 жил өмнө
README.md 17d3d24b6d 提交vendor 1 жил өмнө
composer.json 17d3d24b6d 提交vendor 1 жил өмнө

README.md

think-annotation for ThinkPHP6

安装

composer require topthink/think-annotation

配置

配置文件位于 config/annotation.php

使用方法

<?php

namespace app\controller;

use think\annotation\Inject;
use think\annotation\Route;
use think\annotation\route\Group;
use think\annotation\route\Middleware;
use think\annotation\route\Resource;
use think\Cache;
use think\middleware\SessionInit;

/**
 * Class IndexController
 * @package app\controller
 * @Group("bb")
 * @Resource("aa")
 * @Middleware({SessionInit::class})
 */
class IndexController
{

    /**
     * @Inject()
     * @var Cache
     */
    protected $cache;

    public function index()
    {
        //...
    }

    /**
     * @Route("xx")
     */
    public function xx()
    {
        //...
    }

}

IDE Support

Some IDEs already provide support for annotations: