PHPackages                             issei-m/sf-dependency-injection-plugin - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. issei-m/sf-dependency-injection-plugin

ActiveSymfony1-plugin[Framework](/categories/framework)

issei-m/sf-dependency-injection-plugin
======================================

Supporing Symfony's DependencyInjection component for your symfony1 project

v1.3.1(10y ago)711.3k↓50%5MITPHP

Since Oct 19Pushed 10y ago1 watchersCompare

[ Source](https://github.com/issei-m/sfDependencyInjectionPlugin)[ Packagist](https://packagist.org/packages/issei-m/sf-dependency-injection-plugin)[ RSS](/packages/issei-m-sf-dependency-injection-plugin/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (7)Versions (5)Used By (0)

sfDependencyInjectionPlugin
===========================

[](#sfdependencyinjectionplugin)

[![Build Status](https://camo.githubusercontent.com/1698d8b3f6959adc78630cf3b2c00131f2923cb2b661939094f8040d611a2281/68747470733a2f2f7472617669732d63692e6f72672f69737365692d6d2f7366446570656e64656e6379496e6a656374696f6e506c7567696e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/issei-m/sfDependencyInjectionPlugin)

Provides integration Symfony2's Dependency Injection component with your older symfony (1.4+) project.

Installation
------------

[](#installation)

Using Composer would be best way:

```
$ composer require issei-m/sf-dependency-injection-plugin

```

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
-----

[](#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:

```
# config/services.yml

dev:
  parameters:
    mailer.transport: gmail

all:
  parameters:
    # ...
    mailer.transport: sendmail

  services:
    mailer:
      class:     Mailer
      arguments: ["%mailer.transport%"]
    newsletter_manager:
      class:     NewsletterManager
      calls:
        - [setMailer, ["@mailer"]]
```

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`:

```
class ProjectConfiguration extends sfProjectConfiguration
{
  public function setup()
  {
    $this->enablePlugins('sfDependencyInjectionPlugin');
    ...
  }
}
```

Now, your `sfContext` has installed Symfony's service container, it is used as following in your code:

```
// Get the ServiceContainer.
$container = sfContext::getInstance()->getContainer();

// Retrieve the NewsletterManager class which was initialized with the Mailer.
$newsletterManager = $container->get('newsletter_manager');
```

If you use [lexpress/symfony1](https://github.com/LExpress/symfony1), `sfServiceContainer` is replaced with plugin's service container. But it might work almost as well as framework's one:

```
$container = sfContext::getInstance()->getServiceContainer();
$newsletterManager = sfContext::getInstance()->getService('newsletter_manager');
```

### At task

[](#at-task)

Even though you don't initialize the sfContext at task, you can initialize the service container manually like this:

```
$containerClass = require $this->configuration->getConfigCache()->checkConfig('config/services.yml', true);
$container = new $containerClass();
```

Event
-----

[](#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...:

```
class ProjectConfiguration extends sfProjectConfiguration
{
  public function setup()
  {
    $this->dispatcher->connect('service_container.build', function (sfEvent $event) {
      /** @var \Symfony\Component\DependencyInjection\ContainerBuilder $container */
      $container = $event->getSubject();
      $container->addObjectResource($this);

      // additional parameter
      $container->setParameter('foo', 'bar');

      // add extension
      $container->registerExtension(new YourExtension());

      // add compiler pass
      $container->addCompilerPass(new YourPass());
    });
  }
}
```

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 92% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~207 days

Total

4

Last Release

3964d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/15c23b5cac78ca616a9ba14846080f7115ec937160ef88b2a902e129b18cc1ea?d=identicon)[issei-m](/maintainers/issei-m)

---

Top Contributors

[![issei-m](https://avatars.githubusercontent.com/u/1135118?v=4)](https://github.com/issei-m "issei-m (46 commits)")[![adrianolek](https://avatars.githubusercontent.com/u/886304?v=4)](https://github.com/adrianolek "adrianolek (2 commits)")[![GromNaN](https://avatars.githubusercontent.com/u/400034?v=4)](https://github.com/GromNaN "GromNaN (2 commits)")

---

Tags

plugindependency-injectionservicesymfony1

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/issei-m-sf-dependency-injection-plugin/health.svg)

```
[![Health](https://phpackages.com/badges/issei-m-sf-dependency-injection-plugin/health.svg)](https://phpackages.com/packages/issei-m-sf-dependency-injection-plugin)
```

###  Alternatives

[symfony/framework-bundle

Provides a tight integration between Symfony components and the Symfony full-stack framework

3.6k235.4M9.7k](/packages/symfony-framework-bundle)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.3k](/packages/contao-core-bundle)[shopware/storefront

Storefront for Shopware

684.2M148](/packages/shopware-storefront)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
