cshaptx4869/webman-annotation

v1.0.0 2021-12-02 13:17 UTC

This package is auto-updated.

Last update: 2024-03-29 04:39:11 UTC


README

前言:

webman 注解插件。已实现功能

  • 路由注解

安装

composer require cshaptx4869/webman-annotation

配置

config/route.php 文件添加如下代码:

<?php

use Fairy\AnnotationScanner;

$scanner = new AnnotationScanner();
$scanner->registerRoute();

示例

<?php
namespace app\controller;

use Fairy\Annotation\Route;
use support\Request;

class Index
{
    /**
     * 通过get或者post方式请求 /json 即可访问到当前控制器方法
     * @Route(url="/json", method="GET")
     */
    public function json(Request $request)
    {
        return json(['code' => 0, 'msg' => 'ok']);
    }

}

IDE 注解插件支持

一些ide已经提供了对注释的支持,推荐安装,以便提供注解语法提示