PHP code example of bnf / symfony-service-provider-compiler-pass

1. Go to this page and download the library: Download bnf/symfony-service-provider-compiler-pass 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/ */

    

bnf / symfony-service-provider-compiler-pass example snippets


$registry = new \Bnf\SymfonyServiceProviderCompilerPass\Registry([
    new MyServiceProvide1(),
    new MyServiceProvide2()
]);
// during compilation set:
$container->addCompilerPass(new \Bnf\SymfonyServiceProviderCompilerPass\Registry($registry, 'service_provider_registry'));
$container->compile();
$container->set('service_provider_registry', $registry);

$registry = new \Bnf\SymfonyServiceProviderCompilerPass\Registry([
    MyServiceProvide1::class,
    MyServiceProvide2::class
]);
// during compilation set:
$container->addCompilerPass(new \Bnf\SymfonyServiceProviderCompilerPass\Registry($registry, 'service_provider_registry'));
$container->compile();
$container->set('service_provider_registry', $registry);

$registry = new \Bnf\SymfonyServiceProviderCompilerPass\Registry([
    [ MyServiceProvide1::class, [ "param1", "param2" ] ],
    [ MyServiceProvide2::class, [ 42 ] ],
]);
// during compilation set:
$container->addCompilerPass(new \Bnf\SymfonyServiceProviderCompilerPass\Registry($registry, 'service_provider_registry'));
$container->compile();
$container->set('service_provider_registry', $registry);