PHP code example of jbuncle / simple-dic

1. Go to this page and download the library: Download jbuncle/simple-dic 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/ */

    

jbuncle / simple-dic example snippets



class Baz {

    public __construct();
}

class Bar {

    public __construct(Baz baz);
}

class Foo {

    public __construct(Bar bar);
}

$container = new \JBuncle\SimpleDic\Container();
$fooInstance = $container->getInstance(Foo::class);

$containerFactory = new \JBuncle\SimpleDic\ContainerFactory();
$container = $containerFactory->create();

/* @var $psrContainer \Psr\Container\ContainerInterface */
$psrContainer = new \JBuncle\SimpleDic\PsrAdapter($container);