hamboldt/php-doc-reader

从PHP注释中读取配置,将它们从JSON转换为数组。

v1.0.2 2016-05-10 12:02 UTC

This package is not auto-updated.

Last update: 2024-09-18 10:06:59 UTC


README

License Build Status Scrutinizer Code Quality Latest Stable Version Total Downloads

读取对象和元素中的配置资源,就像以下示例所示

composer require hamboldt/php-doc-reader

示例

<?php

/**
 * Look this amazing configurable class.
 * @configure {"config_name":"config_value"}
 */
class MyConfigurableClass
{
   /**
    * Look this amazing configurable property!
    * @configure {"config_name":"config_value"}
    */
   public $property;
}

// array("config_name" => "config_value")
PhpDocReader\Reader::getConfig('MyConfigurableClass');

// array("config_name" => "config_value")
PhpDocReader\Reader::getConfig('MyConfigurableClass', 'property');