Download the PHP package issei-m/sf-dependency-injection-plugin without Composer
On this page you can find all versions of the php package issei-m/sf-dependency-injection-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download issei-m/sf-dependency-injection-plugin
More information about issei-m/sf-dependency-injection-plugin
Files in issei-m/sf-dependency-injection-plugin
Package sf-dependency-injection-plugin
Short Description Supporing Symfony's DependencyInjection component for your symfony1 project
License MIT
Informations about the package sf-dependency-injection-plugin
sfDependencyInjectionPlugin
Provides integration Symfony2's Dependency Injection component with your older symfony (1.4+) project.
Installation
Using Composer would be best way:
Here, Composer would install this plugin in your plugins
directory and some other libraries plugin depends on into vendor
.
If you don't use Composer, you need to install this plugin and some others manually.
Usage
First, create your services.yml
in %SF_ROOT%/config/services.yml
. It can be defined your parameters/services to each different environments.
Something like:
The services.yml
is supporting the configuratoin cascade like the settings.yml
, and it can be located in several different config
directory for apps (e.g.apps/frontend/config
).
When the ServiceContainer is compiled, the values from these are merged.
Next, enable this plugin at your ProjectConfiguration
:
Now, your sfContext
has installed Symfony's service container, it is used as following in your code:
If you use lexpress/symfony1, sfServiceContainer
is replaced with plugin's service container. But it might work almost as well as framework's one:
At task
Even though you don't initialize the sfContext at task, you can initialize the service container manually like this:
Event
When container is compiled, service_container.build
event is fired. You can expand container definitions if you subscribe this event.
It means you can have control your service container as you wish with your own extension, compiler pass etc...:
All versions of sf-dependency-injection-plugin with dependencies
symfony/config Version ~2.7
composer/installers Version ~1.0.0