Skip to content
/ dic Public

A simple and PSR-11 compliant dependency injection container. Do not use it in production.

License

Notifications You must be signed in to change notification settings

pimolo/dic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dic

A simple and PSR-11 compliant dependency injection container.

Killer feature: you don't need to provide an identifier as it defaults to the FQCN!

(note it doesn't work with scalars #1 but why using scalars in a DIC 😄?)

Usage

<?php

use Pimolo\DIC\Container;
use Psr\Container\ContainerInterface;

require_once 'vendor/autoload.php';

$container = new Container();

$container->set(function () {
    return new \DateTime;
}, 'now');

$container->has('now'); // true

$container->set(function (ContainerInterface $container) {
    return new \SomeManager($container->get(\DateTime::class));
});

About

A simple and PSR-11 compliant dependency injection container. Do not use it in production.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages