gamee / nette-auto-registrator
Automatically register all found classes into DIC
Installs: 6 628
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: >=8.2
- nette/di: ^3.2
- symfony/finder: ^7.1
Requires (Dev)
- gamee/php-code-checker-rules: ^v4.1
This package is auto-updated.
Last update: 2024-10-22 09:56:22 UTC
README
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' => [], ] ); } }