PHP code example of php-di-definitions / definitions-gatherer
1. Go to this page and download the library: Download php-di-definitions/definitions-gatherer 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/ */
php-di-definitions / definitions-gatherer example snippets
use React\EventLoop\Factory;
use React\EventLoop\LoopInterface;
return [
LoopInterface::class => function () {
return Factory::create();
},
];
use DI\ContainerBuilder;
use PHPDIDefinitions\DefinitionsGatherer;
$definitions = iterator_to_array(DefinitionsGatherer::gather());
$containerBuilder = new ContainerBuilder();
$containerBuilder->addDefinitions($definitions);
$container = $containerBuilder->build();
composer
json
{
"extra": {
"php-di-definitions": {
"di": [
"etc/di/event-loop.php"
]
}
}
}