grajewsky/annotations
Composer 安装命令:
composer require grajewsky/annotations
包简介
PHP Annotations Reader OOP
README 文档
README
Quick Use
use \Annotations\Annotations; /** * @Sample value=1 * @SampleTest value=1, test=2 **/ class EntityTestClass { /** * @Test */ private $test = 1; } $annotations = Annotations::read(EntityTestClass::class); print_r($annotations->annotations(Annotations::ALL_ANNOTATIONS));
About structure
Statement $a = Annotations::read(EntityTestClass::class); return Annotations class where you can induce $a->annotations($accessor) method, where the parameter is the key is the character string, where the values are:
- pass const
Annotations::ALL_ANNOTATINS- all the annotations(class and properties/methods) result isArray<Annotation> - pass const
Annotations::CLASS_ANNOTATIONS- accessor return Array<String, Annotation> - annotations of class - pass property name or method to return annotations`
Output:
Array
(
[class] => Array
(
[Sample] => Annotations\Domains\Annotation Object
(
[fields:Annotations\Domains\Annotation:private] => Array
(
[value] => 1
)
[name:Annotations\Domains\Annotation:private] => Sample
)
[SampleTest] => Annotations\Domains\Annotation Object
(
[fields:Annotations\Domains\Annotation:private] => Array
(
[value] => 1
[test] => 2
)
[name:Annotations\Domains\Annotation:private] => SampleTest
)
)
[test] => Array
(
[ORM] => Annotations\Domains\Annotation Object
(
[fields:Annotations\Domains\Annotation:private] => Array
(
[table] => entity
)
[name:Annotations\Domains\Annotation:private] => ORM
)
[Test] => Annotations\Domains\Annotation Object
(
[fields:Annotations\Domains\Annotation:private] => Array
(
)
[name:Annotations\Domains\Annotation:private] => Test
)
)
)
统计信息
- 总下载量: 12
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-05-10