awaitcz / di-attribute
此包最新版本(1.1)没有提供许可证信息。
使用简单属性为 Nette 自动进行类注册
1.1
2024-09-25 19:49 UTC
Requires
- nette/di: ^3.2
Requires (Dev)
- orisai/coding-standard: ^3.10
- phpstan/phpstan: ^1.11
- phpstan/phpstan-nette: ^1.3
README
使用简单属性为 Nette 自动进行类注册。
设置
DiAttibute 可在 composer 上使用
composer require awaitcz/di-attribute
首先注册编译器扩展。
extensions: diAttribute: Awaitcz\DiAttribute\DI\DiAttributeExtension
配置
diAttribute: # Paths to scan for classes paths: - %appDir%/model # If you need to exclude some namespaces or classes excludes: - App\Model\IgnoreMe
用法
<?php declare(strict_types=1); namespace App\Model\Awesome; use Awaitcz\DiAttribute\DiService; #[DiService] class AwesomeService { ... }