1. Go to this page and download the library: Download tmont/blueshift 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/ */
tmont / blueshift example snippets
interface MyInterface {}
class MyType implements MyInterface {
public function __construct(MyOtherType $type) {
$this->type = $type;
}
}
class MyOtherType {
public function __construct($foo) {
$this->foo = $foo;
}
}
$container = new Tmont\BlueShift\Container();
$container
->registerType('MyType', 'MyType')
->registerInstance('MyOtherType', new MyOtherType('bar'));
$myType = $container->resolve('MyType');
echo $myType->type->foo; // 'bar'