2017 © Pedro Peláez
 

library containeraware-bundle

Symfony Bundle: A ContainerAware compiler pass to automatically inject your service container.

image

bentools/containeraware-bundle

Symfony Bundle: A ContainerAware compiler pass to automatically inject your service container.

  • Wednesday, January 24, 2018
  • by bpolaszek
  • Repository
  • 1 Watchers
  • 1 Stars
  • 219 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 20 % Grown

The README.md

Latest Stable Version License Build Status Quality Score Total Downloads, (*1)

This Symfony bundle automatically injects the Service Container into all your services that implement Symfony\Component\DependencyInjection\ContainerAwareInterface., (*2)

[!IMPORTANT]
This repository is no longer maintained and may be removed in a near future. You may consider creating a fork if you still require it., (*3)

Installation

composer require bentools/containeraware-bundle, (*4)

Then, just add this bundle to your AppKernel., (*5)

# app/AppKernel.php

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            // ...
            new BenTools\ContainerAwareBundle\ContainerAwareBundle(), // Insert at the bottom of the array for better performances
        ];

        return $bundles;
    }
}

And that's it! You're ready to go. No need to edit any configuration file., (*6)

You no longer need to explicitely call $service->setContainer($container) in your services.yml or services.xml files., (*7)

Example usage

# src/AppBundle/Services/DummyService.php

namespace AppBundle\Services;

use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;

class DummyService implements ContainerAwareInterface
{
    use ContainerAwareTrait;

    public function doSomethingAwesome()
    {
        $doctrine = $this->container->get('doctrine');
        // do awesome stuff
    }
}
# app/config/services.yml

services:
    dummy.service:
        class: AppBundle\Services\DummyService
        #calls:
            #- [ 'setContainer', [ '@service_container' ] ] # // Not needed anymore

Compatibility

This bundle has been successfully tested against Symfony 2.7 to 3.3 / PHP 5.3 to 7.1., (*8)

See Travis builds for more information., (*9)

Tests

./vendor/bin/phpunit, (*10)

The Versions

24/01 2018

dev-master

9999999-dev

Symfony Bundle: A ContainerAware compiler pass to automatically inject your service container.

  Sources   Download

MIT

The Requires

  • php >=5.3.9

 

The Development Requires

24/01 2018

1.0.3

1.0.3.0

Symfony Bundle: A ContainerAware compiler pass to automatically inject your service container.

  Sources   Download

MIT

The Requires

  • php >=5.3.9

 

The Development Requires

20/12 2017

dev-symfony-4

dev-symfony-4

Symfony Bundle: A ContainerAware compiler pass to automatically inject your service container.

  Sources   Download

MIT

The Requires

 

The Development Requires

20/12 2017

1.0.2

1.0.2.0

Symfony Bundle: A ContainerAware compiler pass to automatically inject your service container.

  Sources   Download

MIT

The Requires

 

The Development Requires

20/11 2017

1.0.1

1.0.1.0

Symfony Bundle: A ContainerAware compiler pass to automatically inject your service container.

  Sources   Download

MIT

The Requires

 

The Development Requires

25/07 2017

1.0

1.0.0.0

Symfony Bundle: A ContainerAware compiler pass to automatically inject your service container.

  Sources   Download

MIT

The Requires

 

The Development Requires