fastd / annotation
Fastd Annotation
v1.0.0
2016-06-18 13:45 UTC
Requires
- php: >=7.0
Requires (Dev)
- phpunit/phpunit: 5.0
This package is not auto-updated.
Last update: 2024-10-26 19:05:20 UTC
README
简单的 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