2017 © Pedro Peláez
 

library symfony-interop-container

Symfony Interop Container which has config array under 'config' key - for Extensions using Interoperability Factories.

image

tomcizek/symfony-interop-container

Symfony Interop Container which has config array under 'config' key - for Extensions using Interoperability Factories.

  • Tuesday, October 10, 2017
  • by tomcizek
  • Repository
  • 1 Watchers
  • 1 Stars
  • 103 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

tomcizek/symfony-interop-container

Build Status Quality Score Code Coverage, (*1)

This bundle is handy when you want to create symfony vendor bundle that uses interoperability factories with interop config., (*2)

Why bother?

It registers 'interop_container' service for you, which has same services as default 'service_container', plus it returns app config array under key 'config'. This config is something you need to define in your extension., (*3)

Quick start

1) Install this library through composer

composer require tomcizek/symfony-interop-container, (*4)

2) Register SymfonyInteropContainerBundle in your kernel

3) Create your Bundle with Extension and register in kernel too, for example:

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);
    }
}

Contribute

Please feel free to fork and extend existing or add new features and send a pull request with your changes! To establish a consistent code quality, please provide unit tests for all your changes and may adapt the documentation., (*5)

The Versions

10/10 2017

dev-master

9999999-dev

Symfony Interop Container which has config array under 'config' key - for Extensions using Interoperability Factories.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Tomáš Čížek

10/10 2017