bvarent/doc-block-tags
最新稳定版本:v0.3
Composer 安装命令:
composer require bvarent/doc-block-tags
包简介
A library to read tags from DocBlocks in PHP class files.
README 文档
README
A library to read tags from DocBlocks in PHP class files. Composed of phpDocumentor, Doctrine Annotations, and Typo3's ReflectionService.
Goals
- Be performant or at least cachable.
- Support custom tag definitions.
- Be a Zend Framework 2 module.
- Provide a ReflectionService.
- Create and manage Doctrine ReflectionClasses itself.
- ReflectionProperty::getType reads @var and class->@property tags.
- Provide information on a whole collection of classes.
- Get all subclasses of a class.
- Get all methods with a certain annotation.
- etc.
- Other useful stuff.
Installation
- Add a requirement in your composer.json file.
- Override the default module configuration in your application.config. See the module.config for documentation.
- Unfortunately, at the moment you have to add some extra config to your composer.json file to have Typo3 installed correctly:
- If you're using doctrine 2.4.x:
{ "require": {"doctrine/orm": "2.4.x as 2.3"} }
- To install into the
vendordir instead of aPackagesdir:
{ "extra": { "installer-paths": "Typo3 by default installs in /Packages. We want it in /vendor.", "installer-paths": { "vendor/typo3/Packages/Framework/{$name}/": ["type:typo3-flow-framework"], "vendor/typo3/Packages/Application/{$name}/": ["type:typo3-flow-package"], "vendor/typo3/Packages/Plugins/{$name}/": ["type:typo3-flow-plugin"], "vendor/typo3/Packages/Sites/{$name}/": ["type:typo3-flow-site"], "vendor/typo3/Packages/Boilerplates/{$name}/": ["type:typo3-flow-boilerplate"], "vendor/typo3/Build/{$name}/": ["type:typo3-flow-build"] } } }
Usage
// A class we want to read the tags from. $testClassName = 'DocBlockTags\Tests\Mock\TaggedClass'; // Get your ZF2 servicemanager from somewhere. $serviceManager = DocBlockTags\Tests\Bootstrap::getServiceManager(); // Get a Doctrine ReflectionClass for our class. $classFinder = $serviceManager->get('DocBlockTags\ClassFinder'); $reflParser = new Doctrine\Common\Reflection\StaticReflectionParser($testClassName, $classFinder); $testClassRefl = $reflParser->getReflectionClass(); // Read some tags. $tagReader = $serviceManager->get('DocBlockTags\TagReader'); $tags = $tagReader->getClassAnnotations($testClassRefl);
Documentation
No more explicit documentation is available at this time.
ToDo
- Cache the TagReader
- Is the TagReader usable by Doctrine\Common\Annotations\CachedReader?
- Make cache configurable and
- Use cache from Doctrine Annotation Reader if configured in Doctrine Module?
- Write tests.
- Make the Reflection Service configurable.
- Make the Reflection Service cachable. (Use Doctrine cache?)
- Make a class to represent a type instead of a string.
- All //TODOs and @todos.
- Get rid of Typo3 dependency.
- More documentation.
- Custom tag classes.
- More examples.
统计信息
- 总下载量: 18
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0
- 更新时间: 2015-01-07