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

AbandonedArchivedLibrary[Framework](/categories/framework)

stanlemon/simple-container
==========================

SimpleContainer is a simple service container with dependency injection.

v0.1.1(13y ago)2205MITPHPPHP &gt;=5.3.3

Since Dec 24Pushed 13y agoCompare

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

READMEChangelogDependenciesVersions (4)Used By (0)

SimpleContainer
===============

[](#simplecontainer)

[![Build Status](https://camo.githubusercontent.com/96fdd455c484aa0f88729c772c56b5ef27edf98757d8fbe78db1a2f3e317bc18/68747470733a2f2f7472617669732d63692e6f72672f7374616e6c656d6f6e2f73696d706c652d636f6e7461696e65722e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/stanlemon/simple-container)

SimpleContainer is a basic service container, it can store key =&gt; value objects and lazily load them using Closures. It also includes a newInstance() method which allows you to inject dependencies through constructors and setters providing for very basic dependency injection.

Example usages
--------------

[](#example-usages)

### Basic loading of services and retrieving of them

[](#basic-loading-of-services-and-retrieving-of-them)

```
// Create the SimpleContainer
$container = new SimpleContainer();
// Set a service
$container->set('foo', function(){
	return new Foo();
});
// Get the service
$foo = $container->get('foo');
// Create a new class with services populaed
$bar = $container->newInstance('bar');
$bar->getFoo();

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

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.

###  Release Activity

Cadence

Every ~2 days

Total

2

Last Release

4891d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

dependency-injectiondiautowire

### Embed Badge

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

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

###  Alternatives

[yiisoft/injector

PSR-11 compatible injector. Executes a callable and makes an instances by injecting dependencies from a given DI container.

942.8M38](/packages/yiisoft-injector)[kdyby/autowired

Syntax sugar for working with services in Nette Framework

30885.7k9](/packages/kdyby-autowired)[mouf/mouf

The Mouf PHP framework: an open-source PHP framework providing an easy way to download, install, use and reuse components, with a graphical user interface.

55146.0k17](/packages/mouf-mouf)[mouf/pimple-interop

This project is a very simple extension to the Pimple microframework. It adds to Pimple compatibility with the container-interop APIs.

102.4M2](/packages/mouf-pimple-interop)[joomla/di

Joomla DI Package

15391.2k11](/packages/joomla-di)[mouf/picotainer

This package contains a really minimalist dependency injection container compatible with container-interop.

16189.8k11](/packages/mouf-picotainer)

PHPackages © 2026

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