2017 © Pedro PelĂĄez
 

symfony-bundle service-provider-bridge-bundle

This Symfony Bundle allows Symfony applications to use service providers as defined in container-interop/service-provider

image

thecodingmachine/service-provider-bridge-bundle

This Symfony Bundle allows Symfony applications to use service providers as defined in container-interop/service-provider

  • Wednesday, November 22, 2017
  • by mouf
  • Repository
  • 4 Watchers
  • 2 Stars
  • 1,837 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 9 Versions
  • 1 % Grown

The README.md

Scrutinizer Code Quality Build Status Coverage Status, (*1)

container-interop/service-provider bridge bundle

Import service-provider as defined in container-interop into a Symfony application., (*2)

Usage

Installation

Add TheCodingMachine\Interop\ServiceProviderBridgeBundle\InteropServiceProviderBridgeBundle in your kernel (the app/AppKernel.php file)., (*3)

AppKernel.php, (*4)

    public function registerBundles()
    {
        $bundles = [
            ...
            new \TheCodingMachine\Interop\ServiceProviderBridgeBundle\InteropServiceProviderBridgeBundle()
        ];
        ...
    }

Usage using thecodingmachine/discovery

The bridge bundle will use thecodingmachine/discvoery to automatically discover the service providers of your project. If the service provider you are loading publishes itself on Discovery, then you are done. The services declared in the service provider are available in the Symfony container!, (*5)

Usage using manual declaration

If the service provider you are using does not publishes itself using thecodingmachine/discovery, you will have to declare it manually in the constructor of the bundle., (*6)

AppKernel.php, (*7)

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            ...
            new \TheCodingMachine\Interop\ServiceProviderBridgeBundle\InteropServiceProviderBridgeBundle([
                new MyServiceProvide1(),
                new MyServiceProvide2()
            ])
        ];
        ...
    }
}

Alternatively, you can also pass the service provider class name. This is interesting because the service-locator bundle will not instantiate the service provider unless it is needed for a service. You can therefore improve performances of your application., (*8)

AppKernel.php, (*9)

    public function registerBundles()
    {
        $bundles = [
            ...
            new \Puli\SymfonyBundle\PuliBundle(),
            new \TheCodingMachine\Interop\ServiceProviderBridgeBundle\InteropServiceProviderBridgeBundle([
                MyServiceProvide1::class,
                MyServiceProvide2::class
            ])
        ];
        ...
    }

Finally, if you need to pass parameters to the constructors of the service providers, you can do this by passing an array:, (*10)

AppKernel.php, (*11)

    public function registerBundles()
    {
        $bundles = [
            ...
            new \Puli\SymfonyBundle\PuliBundle(),
            new \TheCodingMachine\Interop\ServiceProviderBridgeBundle\InteropServiceProviderBridgeBundle([
                [ MyServiceProvide1::class, [ "param1", "param2" ] ],
                [ MyServiceProvide2::class, [ 42 ] ],
            ])
        ];
        ...
    }

Disabling thecodingmachine/discovery

You can disable Discovery by passing false as the second argument of the bundle:, (*12)

AppKernel.php, (*13)

    public function registerBundles()
    {
        $bundles = [
            ...
            // false is passed as second argument. Puli discovery will be disabled.
            new \TheCodingMachine\Interop\ServiceProviderBridgeBundle\InteropServiceProviderBridgeBundle([
                ...
            ], false)
        ];
        ...
    }

Default aliases

By default, this package provides a CommonAliasesServiceProvider that will create the following aliases:, (*14)

  • logger => Psr\Log\LoggerInterface
  • cache.app => Psr\Cache\CacheItemPoolInterface
  • twig => Twig_Environment

This is useful because most service providers expect entries to be available by class/interface name., (*15)

The Versions

22/11 2017

0.3.x-dev

0.3.9999999.9999999-dev

This Symfony Bundle allows Symfony applications to use service providers as defined in container-interop/service-provider

  Sources   Download

MIT

The Requires

 

The Development Requires

symfony psr-11 container-interop service-provider

22/11 2017

v0.3.2

0.3.2.0

This Symfony Bundle allows Symfony applications to use service providers as defined in container-interop/service-provider

  Sources   Download

MIT

The Requires

 

The Development Requires

symfony psr-11 container-interop service-provider

22/09 2017

1.0.x-dev

1.0.9999999.9999999-dev

This Symfony Bundle allows Symfony applications to use service providers as defined in container-interop/service-provider

  Sources   Download

MIT

The Requires

 

The Development Requires

symfony psr-11 container-interop service-provider

21/09 2017

v0.4.1

0.4.1.0

This Symfony Bundle allows Symfony applications to use service providers as defined in container-interop/service-provider

  Sources   Download

MIT

The Requires

 

The Development Requires

symfony psr-11 container-interop service-provider

21/09 2017

v0.4.0

0.4.0.0

This Symfony Bundle allows Symfony applications to use service providers as defined in container-interop/service-provider

  Sources   Download

MIT

The Requires

 

The Development Requires

symfony psr-11 container-interop service-provider

12/12 2016

v0.3.1

0.3.1.0

This Symfony Bundle allows Symfony applications to use service providers as defined in container-interop/service-provider

  Sources   Download

MIT

The Requires

 

The Development Requires

symfony psr-11 container-interop service-provider

01/12 2016

v0.3.0

0.3.0.0

This Symfony Bundle allows Symfony applications to use service providers as defined in container-interop/service-provider

  Sources   Download

MIT

The Requires

 

The Development Requires

symfony psr-11 container-interop service-provider

28/02 2016

v0.2.0

0.2.0.0

This Symfony Bundle allows Symfony applications to use service providers as defined in container-interop/service-provider

  Sources   Download

MIT

The Requires

 

The Development Requires

symfony psr-11 container-interop service-provider

27/02 2016

v0.1.0

0.1.0.0

This Symfony Bundle allows Symfony applications to use service providers as defined in container-interop/service-provider

  Sources   Download

MIT

The Requires

 

The Development Requires

symfony psr-11 container-interop service-provider