PHPackages                             northwoods/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. northwoods/container

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

northwoods/container
====================

Container wrapper for Auryn dependency injector

3.2.0(7y ago)920.2k33MITPHPPHP &gt;=7.1

Since Jun 4Pushed 7y ago1 watchersCompare

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

READMEChangelogDependencies (9)Versions (13)Used By (3)

Northwoods Container
====================

[](#northwoods-container)

[![Become a Supporter](https://camo.githubusercontent.com/28a4011c597c1f2866c7419fcefd80ec11a8591e34f94612242c09e86e8a30dc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f70617472656f6e2d73706f6e736f722532306d652d6536343631612e737667)](https://www.patreon.com/shadowhand)[![Latest Stable Version](https://camo.githubusercontent.com/fea3835350467465cb05884628cf8b9d83a638172c2e0c73bbf274010eed44f7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6f727468776f6f64732f636f6e7461696e65722e737667)](https://packagist.org/packages/northwoods/container)[![License](https://camo.githubusercontent.com/7835264840a871d754771e087d72bf5cb0f3023db55de62f4e9c17552a2835ee/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6e6f727468776f6f64732f636f6e7461696e65722e737667)](https://github.com/northwoods/container/blob/master/LICENSE)[![Build Status](https://camo.githubusercontent.com/dbf58b0db26a3db1976215f360fda7af17a107b98446a28624ce24b020e8531b/68747470733a2f2f7472617669732d63692e6f72672f6e6f727468776f6f64732f636f6e7461696e65722e737667)](https://travis-ci.org/northwoods/container)[![Code Coverage](https://camo.githubusercontent.com/c83befdf6d1c1ab8c6e8c22fa4786cbf324650e24013233933987739b9f69669/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6e6f727468776f6f64732f636f6e7461696e65722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/northwoods/container/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/d3e109341eceff00680612318a790d840b85a2671929e1459429096b6713311f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6e6f727468776f6f64732f636f6e7461696e65722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/northwoods/container/?branch=master)

[Auryn](https://packagist.org/packages/rdlowrey/auryn) is awesome, so why not use it as a container when packages require it?

***Note:** This goes completely against the philosophy of not using Auryn as a service locator. This package is only meant to be a pragmatic solution for Auryn users that want to use a package that requires a service locator.*

Attempts to be [PSR-1](http://www.php-fig.org/psr/psr-1/), [PSR-2](http://www.php-fig.org/psr/psr-2/), [PSR-4](http://www.php-fig.org/psr/psr-4/), and [PSR-11](http://www.php-fig.org/psr/psr-11/) compliant.

Install
-------

[](#install)

```
composer require northwoods/container

```

Usage
-----

[](#usage)

```
use Auryn\Injector;
use Northwoods\Container\InjectorContainer;
use Psr\Container\ContainerInterface;

// Make an Injector and configure it.
$injector = new Injector();

// Optional: Declare a single container instance.
$injector->share(ContainerInterface::class);

// Use InjectorContainer as the implementation of ContainerInterface.
$injector->alias(ContainerInterface::class, InjectorContainer::class);

// InjectorContainer will wrap this Injector instance.
$injector->define(InjectorContainer::class, [':injector' => $injector]);
```

### Configuration

[](#configuration)

This package provides a `InjectorBuilder` that can be used to configure Auryn using separate classes. The builder takes a list of configuration objects and applies each of them to the injector.

```
use Northwoods\Container\Config\ContainerConfig;
use Northwoods\Container\InjectorBuilder;

$builder = new InjectorBuilder([
    new ContainerConfig(),
]);
```

If you prefer to have the injector instantiate the configuration classes, use the `LazyInjectorBuilder`:

```
use Northwoods\Container\Config\ContainerConfig;
use Northwoods\Container\LazyInjectorBuilder;

$builder = new LazyInjectorBuilder([
    ContainerConfig::class,
]);
```

The builder can then be used to create an `Injector` instance:

```
$injector = $builder->build();
$container = $injector->make(ContainerInterface::class);
```

***Note:** An existing instance of Auryn can also be provided to the `build()` method.*

### Zend Service Manager Compatibility

[](#zend-service-manager-compatibility)

This package is compatible with [Zend Expressive Container Config](https://docs.zendframework.com/zend-expressive/v3/features/container/config/):

```
use Northwoods\Container\Zend\Config;
use Northwoods\Container\Zend\ContainerFactory;

$factory = new ContainerFactory();

$container = $factory(new Config(
    require 'path/to/services.php',
));
```

***Note:** All injections configured this way will be shared!*

An existing `Injector` can also be passed into `ContainerFactory`:

```
$factory = new ContainerFactory($injector);
```

This can be combined with `InjectorBuilder` or `LazyInjectorBuilder` to apply configuration such as `define()` calls.

### Identifiers

[](#identifiers)

[PSR-11](http://www.php-fig.org/psr/psr-11/) does not require the container identifier to be a class name, while [Auryn](https://packagist.org/packages/rdlowrey/auryn) does. The only exception to this rule in Auryn is that a [class alias](https://github.com/rdlowrey/auryn#type-hint-aliasing) can be anything. These container "service names" must resolve to a class and will need to be aliased.

For example a package may require a `config` entry in the container that is meant to resolve to an array. This can be achieved by creating a delegate that creates an instance of `ArrayObject`:

```
use ArrayObject;
use Auryn\Injector;
use Northwoods\Container\InjectorContainer;

// Share a global "config" array as an object
$injector->share('config')->delegate('config', function () {
    return new ArrayObject(require 'path/to/config.php');
});

// Create the container
$container = new InjectorContainer($injector);
```

Now whenever `$container->get('config')` is called the `ArrayObject` will be returned.

### Examples

[](#examples)

Additional examples are available in the `examples/` directory.

License
-------

[](#license)

MIT

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 94.7% 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 ~43 days

Recently: every ~68 days

Total

12

Last Release

2797d ago

Major Versions

1.2.1 → 2.0.02017-12-19

2.1.0 → 3.0.02018-04-13

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/38203?v=4)[Woody Gilk](/maintainers/shadowhand)[@shadowhand](https://github.com/shadowhand)

---

Top Contributors

[![shadowhand](https://avatars.githubusercontent.com/u/38203?v=4)](https://github.com/shadowhand "shadowhand (36 commits)")[![Musiksammler](https://avatars.githubusercontent.com/u/312937?v=4)](https://github.com/Musiksammler "Musiksammler (2 commits)")

---

Tags

auryncontainerdependency-injectioninjectorpsr-11containerPSR-11auyrn

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/northwoods-container/health.svg)

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

###  Alternatives

[php-di/php-di

The dependency injection container for humans

2.8k48.9M994](/packages/php-di-php-di)[slince/di

A flexible dependency injection container

20260.4k6](/packages/slince-di)[chubbyphp/chubbyphp-container

A simple PSR-11 container implementation.

1978.4k14](/packages/chubbyphp-chubbyphp-container)[phpwatch/simple-container

A fast and minimal PSR-11 compatible Dependency Injection Container with array-syntax and without auto-wiring

1810.1k2](/packages/phpwatch-simple-container)[selective/container

A simple PSR-11 container implementation with autowiring.

1220.4k4](/packages/selective-container)[devanych/di-container

Simple implementation of a PSR-11 dependency injection container

124.2k3](/packages/devanych-di-container)

PHPackages © 2026

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