1. Go to this page and download the library: Download bigbit/smart-di 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/ */
bigbit / smart-di example snippets
use Symfony\Component\Cache\Simple\ArrayCache;
/** @var Psr\SimpleCache\CacheInterface */
$cache = new ArrayCache();
$container = SmartContainer::createDefault($cache);
$container->define(SomeClass::class, function(ContainerInterface $container) {
return new SomeClass(
$container->get(SomeDependency::class)
);
});
class SomeClass {
public function __construct(SomeService $service, string $primitive, $mixed) { }
}