PSR-11 container storing its values in memory and offering a singleton access.
A simple example:
<?php
namespace vendor\product;
class Greeter
{
public function __construct(\Closure $logic) {
printf('%s%s', $logic('world'), PHP_EOL);
}
}
<?php
use kbATeam\MemoryContainer\Container;
use vendor\product\Greeter;
Container::singleton()->add('hello', function ($what) {
return sprintf('Hello %s!', $what);
});
// ...
$example = new Greeter(Container::singleton()->get('hello'));
Get composer, and install the dependencies.
composer install
Call phpunit to run the tests available.
vendor/bin/phpunit