Componette

Componette

gameeapp

gameeapp / nette-auto-registrator v3.1.0

Automatically register all found classes into DIC

download-cloud-line composer require gamee/nette-auto-registrator

Latest Stable Version License Total Downloads Build Status

gamee/nette-auto-registrator

Using this extension, you don't have to list all classes in neon config. This extension will automatically register all classes for you.

Installation

composer require gamee/nette-auto-registrator

Usage

config.neon:

extensions:
	autoRegistrator: Gamee\AutoRegistrator\DI\AutoRegistratorExtension

autoRegistrator:
	skipDirs:
		- Extension
	scanDirs:
		- %appDir%
	skipFilesPatterns:
		- '/Exception\.php$/'
	skipClasses:
		- App\Foo\Bar
		- App\MyBoomCreator

Yes sir, you can use it also in another extension:

declare(strict_types=1);

namespace MyProject\Foo\DI;

use Gamee\AutoRegistrator\DI\AutoRegistratorExtension;
use Nette\DI\CompilerExtension;

final class FooExtension extends CompilerExtension
{

	public function loadConfiguration(): void
	{
		AutoRegistratorExtension::configure(
			$this->compiler,
			[
				'scanDirs' => [__DIR__ . '/..'],
				'skipDirs' => [
					'Enum'
				],
				'skipFilesPatterns' => [
					'/Extension\.php$/',
					'/Event\.php$/',
				],
				'skipClasses' => [],
			]
		);
	}
}
  • v3.1.0 updated dependencies

  • v3.0.0 PHP 8.0

  • v2.3.0 Skip class when is subclass of defined interface/class

  • v2.2.0 Skip all exceptions by default

  • v2.1.0 v2.1.0

    composer

  • v2.0.1 v2.0.1

    • Travis fix
  • v2.0.0 v2.0.0

    • New gamee/php-code-checker-rules + php 7.4 typed class properties
  • v1.0.0 v1.0.0

    Bump!

price-tag-2-line

Badges

guide-fill

Dependencies

php (>=7.1)
nette/di (^3.0)
Componette Componette felix@nette.org