qa-data/di-service-attribute

Automatic class registration using a simple attribute for Nette

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

This package is auto-updated.

Last update: 2024-12-31 00:20:28 UTC


README

Automatic class registration using a simple attribute for Nette.

Setup

DiAttibute is available on composer:

composer require qa-data/di-service-attribute

At first register compiler extension.

extensions:
	diAttribute: QaData\DiAttribute\DI\DiAttributeExtension

Configuration

diAttribute:
	# Paths to scan for classes
	paths:
		- %appDir%/model
	# If you need to exclude some namespaces or classes
	excludes:
		- App\Model\IgnoreMe

Usage

<?php declare(strict_types=1);

namespace App\Model\Awesome;

use QaData\DiAttribute\DiRegisterService;

#[DiRegisterService]
class AwesomeService
{
	...
}