fastdlabs / annotation

Fastd Annotation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Annotation

Building Latest Stable Version Total Downloads Latest Unstable Version License

简单的 PHP 类注释解析类

要求

  • PHP 5.6+

Composer

composer require "fastd/annotation"

使用

use FastD\Annotation\Reader;
use Tests\AnnotationsClasses\IndexController;

$reader = new Reader();

/**
 * Class IndexController
 * @package Tests\AnnotationsClasses
 *
 * @name foo
 * @json ["abc"]
 * @directive("test")
 * @route("/")
 * @Tests\AnnotationsClasses\AnnotationObject -> test()
 */
$annotation = $reader->getAnnotations(IndexController::class);

$annotation->get('name'); // foo
$annotation->get('json'); // [ 'ab' ]

继承与覆盖

变量同名会覆盖 "父类" 的变量和函数。

Testing

phpunit

License MIT

About

Fastd Annotation

License:MIT License


Languages

Language:PHP 100.0%