awaitcz/di-attribute

此包最新版本(1.1)没有提供许可证信息。

使用简单属性为 Nette 自动进行类注册

1.1 2024-09-25 19:49 UTC

This package is auto-updated.

Last update: 2024-09-25 19:50:27 UTC


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
{
	...
}