2017 © Pedro PelĂĄez
 

symfony-bundle sfcontext-bundle

A context to access statically to the symfony container.

image

theofidry/sfcontext-bundle

A context to access statically to the symfony container.

  • Monday, December 18, 2017
  • by theofidry
  • Repository
  • 1 Watchers
  • 3 Stars
  • 96 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 1 % Grown

The README.md

SfContextBundle

Package version Build Status License, (*1)

A dead simple bundle to be able to access the Symfony Container statically., (*2)

Install

You can use Composer to install the bundle in your project:, (*3)

composer require theofidry/sfcontext-bundle

Then, enable the bundle by updating your app/AppKernel.php file to enable the bundle:, (*4)

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Fidry\SfContextBundle\SfContextBundle(),
    );

    return $bundles;
}

Usage

There are two cases where you might use this bundle:, (*5)

  1. If you don't like dependency injection
  2. For quick & dirty debugging where you can't afford to do a dump
class DummyService
{
    public function foo()
    {
        // Do something

        SfContext::get('logger')->debug('it worked');

        // Do something else
    }
}

Credits

I got the original idea from Laravel facades although the idea is actually not new and you can find it in the Symfony world as sfContext and which has been ported to Symfony 2.x with [sfContextBundle][5]., (*6)

The Versions

18/12 2017

dev-master

9999999-dev

A context to access statically to the symfony container.

  Sources   Download

MIT

The Requires

 

The Development Requires

debug symfony facade

18/12 2017

v1.1.0

1.1.0.0

A context to access statically to the symfony container.

  Sources   Download

MIT

The Requires

 

The Development Requires

debug symfony facade

17/02 2017

v1.0.0

1.0.0.0

A context to access statically to the symfony container.

  Sources   Download

MIT

The Requires

 

The Development Requires

debug symfony facade

16/02 2017

v1.0.0-RC.0

1.0.0.0-RC0

A context to access statically to the symfony container.

  Sources   Download

MIT

The Requires

 

The Development Requires

debug symfony facade