yawa20 / registry-bundle
Registry bundle, Allows to easy implement registry pattern
Installs: 20 349
Dependents: 2
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=7.3
- symfony/config: ^4.3|^5.0
- symfony/dependency-injection: ^4.3|^5.0
- symfony/http-kernel: ^4.3|^5.0
README
any register should implement Yawa20\RegistryBundle\Registry\RegistryInterface
basic implementations you can found in Yawa20\RegistryBundle\Registry\SimpleRegistry
services:
my_custrom_registry:
class: Yawa20\RegistryBundle\Registry\SimpleRegistry
to register items in defined registry:
services:
my_custrom_item:
class: Class\Of\My\Item
tags:
- {name: 'app.registry.item', registry:'my_custrom_registry' }
any of item should implement Yawa20\RegistryBundle\Registrable\RegistrableInterface
by default, registry accepts any item of RegistrableInterface.
if you want to define another, just set it as argument of registry
services:
my_custrom_registry:
class: Yawa20\RegistryBundle\Registry\SimpleRegistry
arguments:
- 'MyCustomInterface'
or, if you want to use autowiring, you just should add tags for you registrable services:
App\MyRegistrableServices\:
resource: '../../src/MyRegistrableServices/*'
tags: [ { name: 'app.registry.item', registry:'MyRegistryClassName' }]