PHPackages                             janschumann/dic - 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. janschumann/dic

ActiveDrupal-module

janschumann/dic
===============

Integrates Symfony´s dependency injection container with drupal.

1.1.0(11y ago)03.1k3[1 issues](https://github.com/janschumann/drupal-dic/issues)1MITPHPPHP &gt;=5.4

Since Jan 27Pushed 9y agoCompare

[ Source](https://github.com/janschumann/drupal-dic)[ Packagist](https://packagist.org/packages/janschumann/dic)[ Docs](https://github.com/janschumann/drupal-dic)[ RSS](/packages/janschumann-dic/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (6)Versions (6)Used By (1)

Drupal dependency injection container integration
=================================================

[](#drupal-dependency-injection-container-integration)

[![Build Status](https://camo.githubusercontent.com/5ef7862be3a07b1cbb6aa61a7adf95e66be08bf8318ff4992155824f8f5735ee/68747470733a2f2f7472617669732d63692e6f72672f6a616e736368756d616e6e2f64727570616c2d6469632e737667)](https://travis-ci.org/janschumann/drupal-dic)

Overview
--------

[](#overview)

Integrates the Symfony´s Dependency Injection Container with drupal.

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

[](#installation)

This project can be checked out with [composer](http://getcomposer.org).

```
{
  "require": {
    "janschumann/dic": "*"
  }
}
```

Confguration
------------

[](#confguration)

Usually no configuration is necessary.

The default dic cache dir will be determined by `DRUPAL_ROOT . '/' . variable_get('file_public_path', '') . '/dic'`.

This can be customized by setting the `dic_root_dir` variable.

**Via shell script:**

```
$ drush vset dic_root_dir
```

**Via php:**

```
variable_set('dic_root_dir', '');
```

Usage
-----

[](#usage)

Class autoloading is done via composer using the [composer\_classloader](https://github.com/janschumann/drupal-composer-classloader) module.

By default a `settings.xml` or an environment specific derivate (`settings_.xml`) is loaded.

### Provided services

[](#provided-services)

This module provides the [symfony event dispacher](http://symfony.com/doc/current/components/event_dispatcher/introduction.html) as a service available through the container.

An instance of the event dispacher can be retrieved by

```
$dispatcher = drupal_dic()->get('event_dispatcher');
```

To add a listener to an event, add te following to your `settings.xml` file.

```

```

An event is dispached by:

```
drupal_dic()->get('event_dispatcher')->dispatch('', );
```

### Register bundles

[](#register-bundles)

Your modules may implement `hook_dic_bundle_info()` as described in `dic.api.php` to register their bundles.

**Example:**

```
/**
 * Implements @see hook_dic_bundle_info()
 */
function _dic_bundle_info() {
  return array('bundles' => array("\\MyNamespace\\MyBundle\\Bundle\\MyBundle\\MyBundle"));
}
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 91.3% 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 ~19 days

Total

5

Last Release

4048d ago

Major Versions

v0.1.1 → 1.0.02015-02-23

PHP version history (2 changes)v0.1.0PHP &gt;=5.3.3

1.1.0PHP &gt;=5.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/85ac46e89d82ee9b6112a3dee706f34a79f4787d2a9e1c0429d6bd5d0f310a2c?d=identicon)[janschumann](/maintainers/janschumann)

---

Top Contributors

[![janschumann](https://avatars.githubusercontent.com/u/276364?v=4)](https://github.com/janschumann "janschumann (21 commits)")[![bitdeli-chef](https://avatars.githubusercontent.com/u/3092978?v=4)](https://github.com/bitdeli-chef "bitdeli-chef (1 commits)")[![mikelohmann](https://avatars.githubusercontent.com/u/600423?v=4)](https://github.com/mikelohmann "mikelohmann (1 commits)")

---

Tags

webdrupal

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/janschumann-dic/health.svg)

```
[![Health](https://phpackages.com/badges/janschumann-dic/health.svg)](https://phpackages.com/packages/janschumann-dic)
```

###  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)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[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)[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)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)

PHPackages © 2026

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