cdx / sf-dependency-injection-bridge
Symfony dependency injection bridge into ZF2
Requires
- php: >=5.5
- symfony/config: ~2.7
- symfony/dependency-injection: ~2.7
- symfony/expression-language: ^2.7
- zendframework/zend-loader: ~2.5
- zendframework/zend-modulemanager: ~2.5
- zendframework/zend-servicemanager: ~2.5
Requires (Dev)
- phpunit/phpunit: ~4.7
This package is not auto-updated.
Last update: 2025-03-29 21:14:12 UTC
README
Zf2 module to use Symfony Dependency Injection (symfony/dependency-injection).
Requirements
Please see the composer.json file.
Installation
You can install using:
curl -s https://getcomposer.org/installer | php
php composer.phar install
You can import the sf-dependency-injection-bridge
module into an existing application
by adding cdx/sf-dependency-injection-bridge
to
your composer.json
"require" section. You should also add the module to your
application's configuration:
'modules' => array ( /* ... */ 'Cdx\SfDependencyInjectionBridge', ),
Configuration
This module load each module configuration files to search the sf_dependency_injection_bridge
key.
To add an dependency you should set in the module configuration file:
return array ( 'router' => /* ... */ 'service_manager' => /* ... */ /* ... */ 'sf_dependency_injection_bridge' => [ 'config_files' => [ __DIR__ . '/services.yml', /* ... */ ], 'service_locator_mapping' => [ 'Doctrine\\ORM\\EntityManager' => 'Doctrine\\ORM\\EntityManager', /* ... */ ] ],
You can specify any service loaded in service locator to set them onto the ContainerBuilder of Symfony. Moreover, you can load any file you want in Yaml format to load services onto it too.
See documentation of Symfony Dependency Injection.