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

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

netolabs/simple-container
=========================

Extremely basic and fast implementation of PSR-11

v0.2.4(4y ago)32.1k12MITPHPPHP &gt;=7.3CI failing

Since Mar 9Pushed 4y ago3 watchersCompare

[ Source](https://github.com/NetoECommerce/simple-container)[ Packagist](https://packagist.org/packages/netolabs/simple-container)[ RSS](/packages/netolabs-simple-container/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (6)Dependencies (5)Versions (7)Used By (2)

Simple Container for PHP
========================

[](#simple-container-for-php)

Extremely basic and fast implementation of the PSR-11 container standard. It's not intended to do fancy dependency injection, just the absolute bare minimum. Consider using PHP-DI or Symfony DI for a more complete implementation.

Install
-------

[](#install)

Via Composer

```
$ composer require netolabs/simple-container
```

Requirements
------------

[](#requirements)

PHP version 7.3 and up is required.

Usage
-----

[](#usage)

### Adding a definition to the container

[](#adding-a-definition-to-the-container)

```
$container = new SimpleContainer();
$service = new MySuperCoolService();

$container->set(MySuperCoolService::class, $service);
```

### Fetching from the container

[](#fetching-from-the-container)

```
if ($container->has(MySuperCoolService::class) {
    $service = $container->get(MySuperCoolService::class);
}
```

### Adding a callable definition

[](#adding-a-callable-definition)

Here we are adding an anonymous function which will be invoked the first time the definition is accessed via `set()`. The computed value will be cached for subsequent accesses.

```
$container = new SimpleContainer();

$container->set('myCallable', function() {
    return 'a computed value';
});

$value = $container->get('myCallable');
// value is 'a computed value'
```

### Invoking the callable for every access

[](#invoking-the-callable-for-every-access)

If you require the callable to be invoked every time you access the definition, you can use the `resolve()` method instead.

```
$value = $container->resolve('myCallable');
// value is 'a computed value'
```

License
-------

[](#license)

The MIT License (MIT). Please see the [License File](https://github.com/NetoECommerce/simple-container/blob/master/LICENSE) for more information.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity45

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

Recently: every ~150 days

Total

6

Last Release

1657d ago

### Community

Maintainers

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

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[pimple/pimple

Pimple, a simple Dependency Injection Container

2.7k130.5M1.4k](/packages/pimple-pimple)[league/container

A fast and intuitive dependency injection container.

86387.8M343](/packages/league-container)[lctrs/psalm-psr-container-plugin

Let Psalm understand better psr11 containers

17648.1k13](/packages/lctrs-psalm-psr-container-plugin)[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)

PHPackages © 2026

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