qa-data/di-service-attribute

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

v1.0 2024-10-01 20:38 UTC

This package is auto-updated.

Last update: 2024-10-01 20:42:29 UTC


README

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

配置

DiAttibute可在Composer上使用

composer require qa-data/di-service-attribute

首先注册编译器扩展。

extensions:
	diAttribute: QaData\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 QaData\DiAttribute\DiRegisterService;

#[DiRegisterService]
class AwesomeService
{
	...
}