1. Go to this page and download the library: Download einenlum/dyc 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/ */
einenlum / dyc example snippets
= new \Dyc\Dic();
$dic->set(\Foo\Bar::class, function(\Dyc\Dic $dic) {
return new \Foo\Bar($dic->get(\Bar\Baz::class));
});
$bar = $dic->get(\Foo\Bar::class);
= new \Dyc\Dic();
$classes = \HaydenPierce\ClassFinder\ClassFinder::getClassesInNamespace('Foo');
$dic->autowire($classes);
$bar = $dic->get(\Foo\Bar::class);
= new \Dyc\Dic();
$classes = \HaydenPierce\ClassFinder\ClassFinder::getClassesInNamespace('Foo');
$dic->autowire($classes);
$dic->set(\Some\Scalar\Dependent\Service::class, function(\Dyc\Dic $dic) {
return new \Some\Scalar\Dependent\Service($dic->get(\Foo\Bar::class), 'some api key');
});
$service = $dic->get(\Some\Scalar\Dependent\Service::class);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.