A simple DI container for the PHPFox framework

Fund package maintenance!

0.3.0 2022-01-31 11:30 UTC

This package is auto-updated.

Last update: 2024-05-29 05:02:29 UTC


GitHub release (latest by date) tests Total Downloads GitHub

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


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


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

$container = Container::getInstance();

    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 from Jess Archer, which provides a great and simple base.