4xxi / strategy-injector
This package is abandoned and no longer maintained.
No replacement package was suggested.
Symfony helper for implementing "Strategy" pattern
Package info
github.com/4xxi/strategy-injector-bundle
Type:symfony-bundle
pkg:composer/4xxi/strategy-injector
1.0.1
2020-01-31 10:24 UTC
Requires
- php: ^7.1.3
- symfony/config: ^4.0
- symfony/dependency-injection: ^4.0
- symfony/http-kernel: ^4.0
This package is auto-updated.
Last update: 2023-07-29 02:05:59 UTC
README
Installation
- Install component via composer
composer require 4xxi/strategy-injector
- Add configuration yaml into
config/packages/strategy_injector.yamlwith following content:
strategy_injector: # For using strategy injector via constructor: # App\Interface: App\CompositeClass # For using strategy injector via method call: # App\Interface: # method: 'addStrategy' # class: App\CompositeClass #
Usage
- Inject via constructor configuration example (that's injects all classes which implements interface on left side of declaration into composite class)
strategy_injector: App\Strategy\FooStrategyInterface: App\Strategy\CompositeFooStrategy
- Inject via method
strategy_injector: App\Strategy\FooStrategyInterface: method: 'addStrategy' class: App\Strategy\CompositeFooStrategy