PHP code example of olvlvl / symfony-dependency-injection-proxy
1. Go to this page and download the library: Download olvlvl/symfony-dependency-injection-proxy 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/ */
olvlvl / symfony-dependency-injection-proxy example snippets
use Psr\Log\LoggerInterface;
class ExceptionHandler
{
public function __construct(private LoggerInterface $logger)
{
}
// …
}
use olvlvl\SymfonyDependencyInjectionProxy\ProxyDumper;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
$builder = new ContainerBuilder();
// …
// Here we load our config, or build the container using clever PHP calls.
// We might even have some compiler passes to add.
// …
$builder->compile();
$dumper = new PhpDumper($builder);
$dumper->setProxyDumper(new ProxyDumper());
/* @var string $containerFile */
file_put_contents($containerFile, $dumper->dump());