定制 grajewsky/annotations 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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 is Array<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

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-05-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固