brandembassy/nette-di-annotation-extension
最新稳定版本:1.4-beta
Composer 安装命令:
composer require brandembassy/nette-di-annotation-extension
包简介
README 文档
README
Allows you to register class as a service via specific annotation.
Usage
Register extension
extensions: discovery: BrandEmbassy\Nette\DI\Extensions\AnnotationExtension('%tempDir%')
Set up extension
in defines a directory in which the extension will search for possible services.
files is optional (default *.php) and defines a file pattern ny which the extension searches for a possible service
discovery: in: '%appDir%' files: '*.php' excludeClasses: # optional - regex pattern to exclude classes from discovery - '/.*Test$/'
Add discovery annotation to your service classes
<?php declare(strict_types = 1); namespace AwesomeApp; /** * @discovery */ class AwesomeService { /* ... */ }
Compatibility with doctrine annotation mapping
Exclude annotation in bootstrap file of your application
\Doctrine\Common\Annotations\AnnotationReader::addGlobalIgnoredName(\BrandEmbassy\Nette\DI\Extensions\AnnotationExtension::ANNOTATION_NAME);
统计信息
- 总下载量: 117
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-11-04