PHP code example of mouf / picotainer
1. Go to this page and download the library: Download mouf/picotainer 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/ */
mouf / picotainer example snippets
use Mouf\Picotainer\Picotainer;
use Psr\Container\ContainerInterface;
$container = new Picotainer([
"myInstance"=>function(ContainerInterface $container) {
return new MyInstance();
},
"myOtherInstance"=>function(ContainerInterface $container) {
return new MyOtherInstance($container->get('myInstance'));
}
"myParameter"=>function(ContainerInterface $container) {
return MY_CONSTANT;
}
], $rootContainer);
$myInstance = $container->get('myInstance');