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 3w 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

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity46

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

1704d 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

[symfony/contracts

A set of abstractions extracted out of the Symfony components

3.9k65.9M138](/packages/symfony-contracts)[api-platform/core

Build a fully-featured hypermedia or GraphQL API in minutes!

2.6k51.2M339](/packages/api-platform-core)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

564576.7k53](/packages/ecotone-ecotone)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[api-platform/state

API Platform state interfaces

274.9M136](/packages/api-platform-state)[wikimedia/parsoid

Parsoid, a bidirectional parser between wikitext and HTML5

187557.3k3](/packages/wikimedia-parsoid)

PHPackages © 2026

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