PHP code example of yoshi2889 / container
1. Go to this page and download the library: Download yoshi2889/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/ */
yoshi2889 / container example snippets
class ExampleClass implements \Yoshi2889\Container\ComponentInterface
{
use \Yoshi2889\Container\ComponentTrait;
public function test()
{
echo 'Hello world!';
}
}
$componentContainer = new \Yoshi2889\Container\ComponentContainer();
$exampleClassInstance = new ExampleClass();
$componentContainer->add($exampleClassInstance);
// echoes 'Hello world!'
ExampleClass::fromContainer($componentContainer)->test();