Skip to content
/ di Public

[READONLY] This is the DI module of the Elephox framework.

License

Notifications You must be signed in to change notification settings

elephox-dev/di

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Elephox DI Module

This module is used by Elephox to provide a dependency injection container. It also has mechanisms to resolve arguments for functions and callbacks.

Example

<?php

use Elephox\DI\ServiceCollectionOld;

$container = new ServiceCollectionOld();
$container->addSingleton(stdClass::class, stdClass::class, fn () => new stdClass());

$foo = function (stdClass $object) {
    return $object;
}

$instance = $container->resolver()->call($foo);
// $instance is an instance of stdClass
// multiple calls to $container->resolver()->callback($foo) will return the same instance, since it was added as a singleton

About

[READONLY] This is the DI module of the Elephox framework.

Resources

License

Stars

Watchers

Forks

Languages