2017 © Pedro Peláez
 

library directory-register

Extension for Nette Framework: register all classes within configured directory (blacklist avalible)

image

ublaboo/directory-register

Extension for Nette Framework: register all classes within configured directory (blacklist avalible)

  • Monday, July 3, 2017
  • by paveljanda
  • Repository
  • 2 Watchers
  • 4 Stars
  • 1,935 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 4 Versions
  • 8 % Grown

The README.md

Latest Stable Version License Total Downloads Gitter, (*1)

DirectoryRegister

Register extension in config.neon:, (*2)

extensions:
    autoRegister: Ublaboo\DirectoryRegister\DI\AutoRegisterExtension

With this extension, all classes within specified directories will be automatically registered in DIC. E.g.:, (*3)

autoRegister:
    dirs: [
        App\Forms: %appDir%/Forms,
        App\ORM\Repository: %appDir%/ORM/Repository
    ]
    interfaces: [
        IFormFactory: %appDir%/Forms,
    ]
    skip: [App\Forms\ContactFormFactory]

Always you have to specify namespace for classes in partucular directory. Let's take following directorystructure as an example:, (*4)

app/
    Forms/
        ContactFormFactory.php
        ProductFormFactory.php
        SignInFormFactory.php
        FooFormFactory.php
        BarFormFactory.php
        BazFormFactory.php

See, now above configuration will be the same as writing all these lines in config.neon:, (*5)

services:
    - App\Forms\ProductFormFactory
    - App\Forms\SignInFormFactory
    - App\Forms\FooFormFactory
    - App\Forms\BarFormFactory
    - App\Forms\BazFormFactory

PSR

This extension is simple and fast, but only works with projects that stick to PSR-0 or PSR-4. So you have to have all automatically registered classes named same as the file is and neither of your files can contain other classes., (*6)

The Versions

03/07 2017

dev-master

9999999-dev https://ublaboo.org/directory-register

Extension for Nette Framework: register all classes within configured directory (blacklist avalible)

  Sources   Download

MIT

The Requires

 

log mail extension nette mailing

10/10 2016

v1.0.2

1.0.2.0 http://ublaboo.paveljanda.com/directory-register

Extension for Nette Framework: register all classes within configured directory (blacklist avalible)

  Sources   Download

MIT

The Requires

 

log mail extension nette mailing

02/07 2016

v1.0.1

1.0.1.0 http://ublaboo.paveljanda.com/directory-register

Extension for Nette Framework: register all classes within configured directory (blacklist avalible)

  Sources   Download

MIT

The Requires

 

log mail extension nette mailing

20/01 2016

v1.0.0

1.0.0.0 http://ublaboo.paveljanda.com/directory-register

Extension for Nette Framework: register all classes within configured directory (blacklist avalible)

  Sources   Download

MIT

The Requires

 

log mail extension nette mailing