1. Go to this page and download the library: Download drhino/container 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/ */
drhino / container example snippets
class Dependency
{
public string $var = '';
}
class Init
{
public function __construct(Dependency $dependency, String $value)
{
$dependency->var = $value;
}
}
$container = new drhino\Container\Container;
$container
->add(Init::class, [
// The arguments of the constructor
'dependency' => $container->ref(Dependency::class),
'value' => 'Hello world',
])
->add(Dependency::class)
;