cdx/sf-dependency-injection-bridge

Symfony dependency injection bridge into ZF2

dev-master 2015-07-10 12:56 UTC

This package is not auto-updated.

Last update: 2024-04-13 15:28:39 UTC


README

Build Status

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.