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

ActiveLibrary

phpfox/container
================

A simple DI container for the PHPFox framework

0.3.0(4y ago)412.0k—0%11MITPHPPHP ^8.0

Since Jun 17Pushed 4y ago1 watchersCompare

[ Source](https://github.com/PHP-Fox/container)[ Packagist](https://packagist.org/packages/phpfox/container)[ GitHub Sponsors](https://github.com/JustSteveKing)[ RSS](/packages/phpfox-container/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (4)Used By (1)

PHP-Fox Container
=================

[](#php-fox-container)

[![GitHub release (latest by date)](https://camo.githubusercontent.com/40e6172bc5afba0fdbd42b6146ac2010ee3820a58799a7e236b682b188c8f778/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f7068702d666f782f636f6e7461696e6572)](https://camo.githubusercontent.com/40e6172bc5afba0fdbd42b6146ac2010ee3820a58799a7e236b682b188c8f778/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f7068702d666f782f636f6e7461696e6572)[![tests](https://github.com/PHP-Fox/container/workflows/run-tests/badge.svg)](https://github.com/PHP-Fox/container/workflows/run-tests/badge.svg)[![Total Downloads](https://camo.githubusercontent.com/131c6caa7dfe755e979d1d58541b5b21d929cff7633f9d56893e7a9899b6d2b1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f706870666f782f636f6e7461696e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/phpfox/container)[![GitHub](https://camo.githubusercontent.com/348fd3d3044f7d6ecc189985cfe7787c09fcf4f336bda770450e45826aa61f54/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f7068702d666f782f636f6e7461696e6572)](https://camo.githubusercontent.com/348fd3d3044f7d6ecc189985cfe7787c09fcf4f336bda770450e45826aa61f54/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f7068702d666f782f636f6e7461696e6572)

This is the repository for the DI Container used in the PHP-Fox framework.

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

[](#installation)

You should not need to install this package when using the PHP-Fox framework, however if you wish to use this outside of the framework please use:

```
composer require phpfox/container
```

Usage
-----

[](#usage)

To use the container, all you need to do is:

```
$container = Container::getInstance();

$container->bind(
    abstract: Abstract::class,
    concrete: Concrete::class,
    shared: false, // defaults to false - true turns this into a singleton.
);

/**
 * @var bool
 */
$exists = $container->has(
    id: Abstract::class,
);

/**
 * @var Concrete
 */
$concrete = $container->make(
    abstract: Abstract::class,
);
```

Container implementation inspired by [example repo](https://github.com/jessarcher/service-container-from-scratch) from [Jess Archer](https://github.com/jessarcher), which provides a great and simple base.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75% 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 ~114 days

Total

3

Last Release

1568d ago

### 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 (15 commits)")[![chapterjason](https://avatars.githubusercontent.com/u/1337562?v=4)](https://github.com/chapterjason "chapterjason (5 commits)")

###  Code Quality

TestsPest

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[pimple/pimple

Pimple, a simple Dependency Injection Container

2.7k130.5M1.4k](/packages/pimple-pimple)[neos/flow

Flow Application Framework

862.0M451](/packages/neos-flow)[api-platform/state

API Platform state interfaces

223.4M57](/packages/api-platform-state)[internal/dload

Downloads binaries.

98142.7k10](/packages/internal-dload)[symfony/json-streamer

Provides powerful methods to read/write data structures from/into JSON streams.

14440.0k8](/packages/symfony-json-streamer)[rubix/server

Deploy your Rubix ML models to production with scalable stand-alone inference servers.

632.3k](/packages/rubix-server)

PHPackages © 2026

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