PHPackages                             contao-community-alliance/dependency-container - 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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. contao-community-alliance/dependency-container

AbandonedArchivedContao-bundle[PSR &amp; Standards](/categories/psr-standards)

contao-community-alliance/dependency-container
==============================================

Dependency container based on pimple for Contao open source cms.

2.1.1(3y ago)1128.5k↑100%420LGPL-3.0-or-laterPHPPHP ^7.4 || ^8.0

Since May 17Pushed 3y ago8 watchersCompare

[ Source](https://github.com/contao-community-alliance-archive/dependency-container)[ Packagist](https://packagist.org/packages/contao-community-alliance/dependency-container)[ Docs](https://c-c-a.org/)[ RSS](/packages/contao-community-alliance-dependency-container/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (8)Versions (32)Used By (20)

Dependency Injection Container for Contao Open Source CMS
=========================================================

[](#dependency-injection-container-for-contao-open-source-cms)

[![Version](https://camo.githubusercontent.com/f37236e68fbded9f26ebfaaaeca983dbf88a83e0b30aeaeee36407527f940819/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f6e74616f2d636f6d6d756e6974792d616c6c69616e63652f646570656e64656e63792d636f6e7461696e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/contao-community-alliance/dependency-container)[![Build Status](https://github.com/contao-community-alliance/dependency-container/actions/workflows/diagnostics.yml/badge.svg)](https://github.com/contao-community-alliance/dependency-container/actions)[![License](https://camo.githubusercontent.com/485b9885a26481c93f8c70c94280fc41366f05f06b07c380481c50f130d58fda/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f636f6e74616f2d636f6d6d756e6974792d616c6c69616e63652f646570656e64656e63792d636f6e7461696e65722e7376673f7374796c653d666c61742d737175617265)](http://spdx.org/licenses/LGPL-3.0+)[![Downloads](https://camo.githubusercontent.com/5b6438289b9ee4bbd3e9ba94d5a39ff3e3bde049432ed7607d159cb1374026d9/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f6e74616f2d636f6d6d756e6974792d616c6c69616e63652f646570656e64656e63792d636f6e7461696e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/contao-community-alliance/dependency-container)

This DI Container based on [Pimple](http://pimple.sensiolabs.org).

***NOTE on Contao 4:*** This is obsolete in Contao 4 - you should use the symfony container in Contao 4.

This extension keeps compatibility for easing migration to Contao 4 - however, you should change your code to register your services using both registration ways.

For a howto of how to migrate to Contao 4, please refer to the [UPGRADING-TO-CONTAO4.md](UPGRADING-TO-CONTAO4.md)

Register parameters and services
--------------------------------

[](#register-parameters-and-services)

system/modules/X/config/services.php

```
$container['myservice.param'] = 'value';
$container['myservice'] = function($container) {
    return new MyServiceClassName();
}
```

Access parameters and services
------------------------------

[](#access-parameters-and-services)

```
class MyClass
{
    function myFunction()
    {
        global $container;

        $parameter = $container['myservice.param'];
        $service = $container['myservice'];
    }
}
```

Build-in services
-----------------

[](#build-in-services)

### The config object

[](#the-config-object)

```
/** @var \Config $config */
$config = $container['config'];
```

### The environment object

[](#the-environment-object)

```
/** @var \Environment $environment */
$environment = $container['environment'];
```

### The database connection

[](#the-database-connection)

```
/** @var \Database $database */
$database = $container['database.connection'];
```

### The input object

[](#the-input-object)

```
/** @var \Input $input */
$input = $container['input'];
```

### The backend or frontend user, depend on TL\_MODE

[](#the-backend-or-frontend-user-depend-on-tl_mode)

```
/** @var \BackendUser|\FrontendUser $user */
$user = $container['user'];
```

### The session object

[](#the-session-object)

```
/** @var \Session $session */
$session = $container['session'];
```

### Lazy access to the $objPage object

[](#lazy-access-to-the-objpage-object)

```
/** @var DependencyInjection\Container\PageProvider */
$pageProvider = $container['page-provider'];
$page         = $pageProvider->getPage();
```

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community36

Small or concentrated contributor base

Maturity79

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~125 days

Recently: every ~368 days

Total

28

Last Release

1345d ago

Major Versions

1.8.3 → 2.0.02018-01-16

PHP version history (4 changes)1.0PHP &gt;=5.3

2.0.0PHP &gt;=5.6

2.0.1PHP ^5.6 || ^7.0

2.1.0PHP ^7.4 || ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/44649522?v=4)[xtra](/maintainers/xtra)[@xtra](https://github.com/xtra)

![](https://avatars.githubusercontent.com/u/10211934?v=4)[Chibineko](/maintainers/Chibineko)[@chibineko](https://github.com/chibineko)

![](https://avatars.githubusercontent.com/u/8189209?v=4)[netzmacht](/maintainers/netzmacht)[@netzmacht](https://github.com/netzmacht)

![](https://avatars.githubusercontent.com/u/8672569?v=4)[California College of Arts](/maintainers/cca)[@cca](https://github.com/cca)

![](https://avatars.githubusercontent.com/u/5380530?v=4)[zonky](/maintainers/zonky)[@zonky](https://github.com/zonky)

---

Top Contributors

[![discordier](https://avatars.githubusercontent.com/u/940331?v=4)](https://github.com/discordier "discordier (84 commits)")[![tristanlins](https://avatars.githubusercontent.com/u/343404?v=4)](https://github.com/tristanlins "tristanlins (50 commits)")[![baumannsven](https://avatars.githubusercontent.com/u/2493263?v=4)](https://github.com/baumannsven "baumannsven (45 commits)")[![stefanheimes](https://avatars.githubusercontent.com/u/988286?v=4)](https://github.com/stefanheimes "stefanheimes (5 commits)")[![e-spin](https://avatars.githubusercontent.com/u/6942009?v=4)](https://github.com/e-spin "e-spin (4 commits)")[![dmolineus](https://avatars.githubusercontent.com/u/1186266?v=4)](https://github.com/dmolineus "dmolineus (3 commits)")[![richardhj](https://avatars.githubusercontent.com/u/1284725?v=4)](https://github.com/richardhj "richardhj (3 commits)")[![zonky2](https://avatars.githubusercontent.com/u/1045318?v=4)](https://github.com/zonky2 "zonky2 (2 commits)")[![dominikzogg](https://avatars.githubusercontent.com/u/1011217?v=4)](https://github.com/dominikzogg "dominikzogg (2 commits)")[![andreasisaak](https://avatars.githubusercontent.com/u/156767?v=4)](https://github.com/andreasisaak "andreasisaak (1 commits)")

---

Tags

containerdependencyinjectiondicontaocca

### Embed Badge

![Health badge](/badges/contao-community-alliance-dependency-container/health.svg)

```
[![Health](https://phpackages.com/badges/contao-community-alliance-dependency-container/health.svg)](https://phpackages.com/packages/contao-community-alliance-dependency-container)
```

###  Alternatives

[league/container

A fast and intuitive dependency injection container.

86387.8M343](/packages/league-container)[contao-community-alliance/dc-general

Universal data container for Contao

1578.3k86](/packages/contao-community-alliance-dc-general)[capsule/di

A PSR-11 compliant autowiring dependency injection container.

2857.5k2](/packages/capsule-di)[miladrahimi/phpcontainer

Dependency injection (IoC) container for PHP projects

1322.7k2](/packages/miladrahimi-phpcontainer)

PHPackages © 2026

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