qa-data / di-service-attribute
Automatic class registration using a simple attribute for Nette
v1.0
2024-10-01 20:38 UTC
Requires
- php: >=8.1
- nette/di: ^3.2
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 { ... }