PHP code example of dmitry-suffi / di
1. Go to this page and download the library: Download dmitry-suffi/di library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
dmitry-suffi / di example snippets
use suffi\di\Container;
$foo = new Foo();
$bar = new Bar();
$thy = new Thy();
$container->set('foo', $foo);
$container->set('bar', $bar);
$container->set('thy', $thy);
$container->setDefinition('common', 'Common')
->parameter('foo', 'foo')
->property('bar', $bar)
->setter('thy', 'thy');
$common = $container->get('common');