PHPackages                             mead-steve/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. [Framework](/categories/framework)
4. /
5. mead-steve/container

AbandonedLibrary[Framework](/categories/framework)

mead-steve/container
====================

Simple Dependency Injection Container.

08PHP

Since Dec 19Pushed 12y ago1 watchersCompare

[ Source](https://github.com/meadsteve/Container)[ Packagist](https://packagist.org/packages/mead-steve/container)[ RSS](/packages/mead-steve-container/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Container
=========

[](#container)

Very basic dependency injection container.

Build status
------------

[](#build-status)

branchstatusmaster[![Build Status](https://camo.githubusercontent.com/c444c4581256b62e8f31f6df82b25af3c73100f4f6381d450e99e3600928a232/68747470733a2f2f7472617669732d63692e6f72672f6d65616473746576652f436f6e7461696e65722e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/meadsteve/Container)Example Usage
=============

[](#example-usage)

Setup a resource in the container:

```
use \Meadsteve\Container\Container;
use \Meadsteve\Container\Singleton;

$MyContainer = new Container();

$MyContainer->DependancyOne = new Dependancy();
$MyContainer->MyObject = function(Container $Container) {
	return new MyObject($Container->DependancyOne);
};
```

Then when you need an instance of MyObject:

```
$InstanceOfMyObject = $MyContainer->MyObject;
```

For some heavy objects you may not want to run the construction logic each time. Then you may want to use the singleton pattern. This is possible with the provided class:

```
$MyContainer->DBUser = "DBGuy";
$MyContainer->Password = "SuperSecret10";
$MyContainer->DBBasedObject = new Singleton(function(Container $Container) {
	return new DBObject($Container->DBUser, $Container->Password);
});
```

Which is then retrieved in exactly the same way:

```
$DBInstance = $MyContainer->DBBasedObject
```

###  Health Score

20

—

LowBetter than 12% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/6f6a1fc7be44918da7cc299d340d1e27b338e2396c2f2ca389857b4e2e197c4b?d=identicon)[MeadSteve](/maintainers/MeadSteve)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[nineinchnick/edatatables

Grid widget for the Yii Framework, wrapper for the DataTables jQuery plugin

173.2k](/packages/nineinchnick-edatatables)

PHPackages © 2026

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