PHPackages                             adamlundrigan/ldc-zf1-di-leaguecontainer - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. adamlundrigan/ldc-zf1-di-leaguecontainer

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

adamlundrigan/ldc-zf1-di-leaguecontainer
========================================

Basic controller dependency injection in ZF1 with League\\Container

1.1.0(10y ago)232[1 issues](https://github.com/adamlundrigan/ldc-zf1-di-leaguecontainer/issues)BSD-3-ClausePHP

Since Jun 30Pushed 10y ago1 watchersCompare

[ Source](https://github.com/adamlundrigan/ldc-zf1-di-leaguecontainer)[ Packagist](https://packagist.org/packages/adamlundrigan/ldc-zf1-di-leaguecontainer)[ RSS](/packages/adamlundrigan-ldc-zf1-di-leaguecontainer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (4)Versions (3)Used By (0)

LdcZf1DiLeagueContainer
=======================

[](#ldczf1dileaguecontainer)

[![Latest Stable Version](https://camo.githubusercontent.com/76821f7fb7f0d20c476fdc87754031d0d8d8e541e1121c9f159b1f02f584284c/68747470733a2f2f706f7365722e707567782e6f72672f6164616d6c756e64726967616e2f6c64632d7a66312d64692d6c6561677565636f6e7461696e65722f762f737461626c652e737667)](https://packagist.org/packages/adamlundrigan/ldc-zf1-di-leaguecontainer) [![License](https://camo.githubusercontent.com/cc7264dc29ec953d2928f9d92f6456c221449700fece7cee7ef41560566fdac3/68747470733a2f2f706f7365722e707567782e6f72672f6164616d6c756e64726967616e2f6c64632d7a66312d64692d6c6561677565636f6e7461696e65722f6c6963656e73652e737667)](https://packagist.org/packages/adamlundrigan/ldc-zf1-di-leaguecontainer) [![Build Status](https://camo.githubusercontent.com/8c2af8b927314b388672e5c4bd379ea7d3745b28b5d340c973eab0695276e4cc/68747470733a2f2f7472617669732d63692e6f72672f6164616d6c756e64726967616e2f6c64632d7a66312d64692d6c6561677565636f6e7461696e65722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/adamlundrigan/ldc-zf1-di-leaguecontainer) [![Code Coverage](https://camo.githubusercontent.com/fe4d9387c221ba0c85dbcc11faac50a714044bbc9cc8f96eaf75a6e450046371/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6164616d6c756e64726967616e2f6c64632d7a66312d64692d6c6561677565636f6e7461696e65722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/adamlundrigan/ldc-zf1-di-leaguecontainer/?branch=master) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/2f8317de7e1a50701598213632421153a2225e4a83c49ce771a6e5a4aad5f6b1/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6164616d6c756e64726967616e2f6c64632d7a66312d64692d6c6561677565636f6e7461696e65722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/adamlundrigan/ldc-zf1-di-leaguecontainer/?branch=master)

What?
-----

[](#what)

It's a simple glue layer which injects services registered in a [League\\Container](http://container.thephpleague.com) into a ZF1 controller.

Heavily based on [@weierophinney](https://github.com/weierophinney)'s now-many-moons-ago blog post "[A Simple Resource Injector for ZF Action Controllers](https://mwop.net/blog/235-A-Simple-Resource-Injector-for-ZF-Action-Controllers.html)".

How?
----

[](#how)

1. Install the [Composer](https://getcomposer.org/) package:

    ```
    composer require adamlundrigan/ldc-zf1-di-league-container:1.*@stable

    ```
2. Register the helper in your ZF1 application bootstrap:

    ```
    protected function _initContainer()
    {
        $container = new League\Container\Container();
        // Fill your container
        return $container;
    }

    protected function _initContainerResourceInjector()
    {
        $this->bootstrap('container');

        Zend_Controller_Action_HelperBroker::addHelper(
            new \LdcZf1DiLeagueContainer\DependencyInjector()
        );
    }

    ```
3. In each controller, define a list of dependencies to inject:

    ```
    class FooController extends Zend_Controller_Action
    {
        public $dependencies = array(
            'db',
            'layout',
            'navigation',
        );
    }

    ```

    If you use a non-numeric key for any value of `$dependencies` the injector will use that as the controller property to inject into.
4. Profit! The injector will create a public property on the controller instance for each named service.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~2 days

Total

2

Last Release

3973d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/efe3be096f7961d939736de0a7870c7715b2680d44ed96f895647b4acc6be58c?d=identicon)[adamlundrigan](/maintainers/adamlundrigan)

---

Top Contributors

[![adamlundrigan](https://avatars.githubusercontent.com/u/527329?v=4)](https://github.com/adamlundrigan "adamlundrigan (4 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/adamlundrigan-ldc-zf1-di-leaguecontainer/health.svg)

```
[![Health](https://phpackages.com/badges/adamlundrigan-ldc-zf1-di-leaguecontainer/health.svg)](https://phpackages.com/packages/adamlundrigan-ldc-zf1-di-leaguecontainer)
```

###  Alternatives

[consolidation/robo

Modern task runner

2.7k62.9M410](/packages/consolidation-robo)[roach-php/core

A complete web scraping toolkit for PHP

1.5k352.4k3](/packages/roach-php-core)[ec-europa/toolkit

Toolkit packaged for Drupal projects based on Robo.

38244.6k16](/packages/ec-europa-toolkit)

PHPackages © 2026

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