PHP code example of tomcizek / symfony-interop-container
1. Go to this page and download the library: Download tomcizek/symfony-interop-container 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/ */
tomcizek / symfony-interop-container example snippets
class TestExtension extends AbstractInteropExtension
{
public function load(array $configs, ContainerBuilder $containerBuilder)
{
// parent call is mandatory, or it will not work as expected!
parent::load($configs, $containerBuilder);
// we can set another config key (default is extension alias: $this->getAlias())
$this->configBuilder->setKey('test');
// we can merge over another config
$this->configBuilder->mergeOverByConfig([]);
// we can merge over multiple configs
$this->configBuilder->mergeOverByConfigs([[]]);
// we can merge default config
$this->configBuilder->mergeDefaultConfig([]);
// if you want, you can build config by:
$config = $this->configBuilder->build();
// it will be built in process method and injected into interop_container service
}
public function process(ContainerBuilder $containerBuilder)
{
// If you need to redefine process method, parent call is mandatory.
parent::process($containerBuilder);
}
}