2017 © Pedro Peláez
 

library di

Dependency Injection for PHP

image

fabs/di

Dependency Injection for PHP

  • Tuesday, February 20, 2018
  • by fabsolute
  • Repository
  • 2 Watchers
  • 3 Stars
  • 113 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Dependency Injection for PHP

Library that provides ways to use DI for PHP developers., (*1)

Install

Install the library like this composer require fabs/di, (*2)

Quick Start

Set a service with lazy loading, (*3)

$di = DI::getDefault();

$di->set('function_example',function(){
    return new MyCustomService();
});
// or
$di->set('class_name_example', MyCustomService::class);
// or
$di->set('parameter_example',function($first,$second){
    return new MyCustomService($first, $second);
})->setParameters([1,'second']);

Set a service without lazy loading, (*4)

$di = DI::getDefault();

$di->set('test_service', new MyCustomService());

Set a shared service, (*5)

$di = DI::getDefault();

$di->setShared('test_service', new MyCustomService());
// or
$di->set('test_service', new MyCustomService(), true);

Get a service, (*6)

$di = DI::getDefault();

$service = $di->get('test_service');
// or
$service = $di['test_service'];
// or
$service = $di->get('parameter_example',[8,'example']);

The Versions

20/02 2018

dev-master

9999999-dev

Dependency Injection for PHP

  Sources   Download

MIT

The Requires

 

dependency injection php dependency di injection

20/02 2018

v1.03

1.03.0.0

Dependency Injection for PHP

  Sources   Download

MIT

The Requires

 

dependency injection php dependency di injection

16/02 2018

dev-develop

dev-develop

Dependency Injection for PHP

  Sources   Download

MIT

The Requires

 

dependency injection php dependency di injection

21/03 2017

v1.02

1.02.0.0

Dependency Injection for PHP

  Sources   Download

MIT

dependency injection php dependency di injection

21/03 2017

v1.01

1.01.0.0

Dependency Injection for PHP

  Sources   Download

MIT

dependency injection php dependency di injection

20/03 2017

v1.0

1.0.0.0

Dependency Injection for PHP

  Sources   Download

MIT

dependency injection php dependency di injection