Skip to content

timglabisch/diBundle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Tg\DiBundle

how it works

    use Tg\DiBundle\Annotation\Inject;

    class DefaultController extends Controller {


        /** @Inject */
        public function indexAction($serviceLogger) {
            return $this->render('...');
        }
    }

after installing the bundle you can just add the @Inject Annotation to non-service controllers and get any service based on the name. Parameters that are not prefixed with "service" are ignored. For example $serviceLogger looks for the service "logger" and inject it, it strips the prefix "service" and uclower the Servicename.

Installation

add this to your composer file:

    "repositories": [
        { "type": "vcs", "url": "https://github.com/timglabisch/diBundle" }
    ],
    "require": {
        "tg/di-bundle": "dev-master"
    }

add this to your appKernel

    $bundles = array(
        new Tg\DiBundle\TgDiBundle(),
    );

About

very easy bundle to inject services using controller annotations

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages