1. Go to this page and download the library: Download usmanhalalit/viocon 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/ */
usmanhalalit / viocon example snippets
$container = new \Viocon\Container();
new \Viocon\Container('Container');
\Container::set(...);
\Container::build(...);
$container->set('myClosure', function ($test1, $test2)
{
$stdClass = new \stdClass();
$stdClass->testVar1 = $test1;
$stdClass->testVar2 = $test2;
$stdClass->testMethod = function ($test3) {
return $test3;
};
return $stdClass;
});
$object = $container->build('myClosure', array('Test Var 1', 'Test Var 2'))
echo $object->testVar1;