awaitcz/di-attribute

There is no license information available for the latest version (1.1) of this package.

Automatic class registration using a simple attribute for Nette

1.1 2024-09-25 19:49 UTC

This package is auto-updated.

Last update: 2024-12-25 20:20:26 UTC


README

Automatic class registration using a simple attribute for Nette.

Setup

DiAttibute is available on composer:

composer require awaitcz/di-attribute

At first register compiler extension.

extensions:
	diAttribute: Awaitcz\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 Awaitcz\DiAttribute\DiService;

#[DiService]
class AwesomeService
{
	...
}