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

ActiveLibrary

sauber-php/container
====================

The Container component for the Sauber PHP framework

048PHP

Since May 27Pushed 3y ago1 watchersCompare

[ Source](https://github.com/sauber-php/container)[ Packagist](https://packagist.org/packages/sauber-php/container)[ RSS](/packages/sauber-php-container/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-direct.svg)](https://supportukrainenow.org/)

Container
=========

[](#container)

[![GitHub release (latest by date)](https://camo.githubusercontent.com/f0e31ce9b9ca1a5b5b471de192eae29eb4ee84d577a35a5cec0f84ac95b5397f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f7361756265722d7068702f636f6e7461696e6572)](https://camo.githubusercontent.com/f0e31ce9b9ca1a5b5b471de192eae29eb4ee84d577a35a5cec0f84ac95b5397f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f7361756265722d7068702f636f6e7461696e6572)[![Tests](https://github.com/sauber-php/container/workflows/tests/badge.svg)](https://github.com/sauber-php/container/workflows/tests/badge.svg)[![Static Analysis](https://github.com/sauber-php/container/workflows/static/badge.svg)](https://github.com/sauber-php/container/workflows/static/badge.svg)[![Total Downloads](https://camo.githubusercontent.com/bde2ade3764414839a7788c9faa92fc9eba9fdb4967cfb89ace4ded64d350bb7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7361756265722d7068702f636f6e7461696e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/phpfox/container)[![GitHub](https://camo.githubusercontent.com/cca41d84ad9e3f30c07665037bf547f003ffcab3ac7bb01cf0fb54218a5d3fa1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f7361756265722d7068702f636f6e7461696e6572)](https://camo.githubusercontent.com/cca41d84ad9e3f30c07665037bf547f003ffcab3ac7bb01cf0fb54218a5d3fa1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f7361756265722d7068702f636f6e7461696e6572)

This is the repository for the DI Container used in the Sauber PHP Framework.

Installation
------------

[](#installation)

You should not need to install this package, as it comes pre-installed with the Sauber PHP Framework, however if you want to use this outside of the framework please use composer:

```
composer require sauber-php/container
```

Usage
-----

[](#usage)

To use the container, you can manually add definitions:

```
$container = new Container(
    definitions: [
        UserRepositoryInterface::class => UserRepository::class,
    ],
);

$repository = $container->get(
    id: UserRepositoryInterface::class,
);
```

To make a new container with injected callables:

```
$injectors = [
    UserRepositoryInterface::class => UserRepository::class,
];

$container = Container::make(
    injectors: $injectors,
);

$repository = $container->get(
    id: UserRepositoryInterface::class,
);
```

Testing
-------

[](#testing)

To run the tests:

```
./vendor/bin/pest
```

Static Analysis
---------------

[](#static-analysis)

To check the static analysis:

```
./vendor/bin/phpstan analyse
```

Changelog
---------

[](#changelog)

Please see [the Changelog](CHANGELOG.md) for more information on what has changed recently.

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity26

Early-stage or recently created project

 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/a87fe82b349821ebd49cf57d65c4cd3e33ae0833222a8438d90fe8921ca899ea?d=identicon)[JustSteveKing](/maintainers/JustSteveKing)

---

Top Contributors

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

### Embed Badge

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

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

PHPackages © 2026

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