Lets you inject services and container parameters into controllers.
"require" : {
// ...
"astina/injection-bundle":"dev-master",
}
Enable the bundle in the kernel:
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Astina\Bundle\InjectionBundle\AstinaInjectionBundle(),
);
}
##Usage
use Astina\Bundle\InjectionBundle\Annotation as Inject;
class DefaultController
{
/**
* @Inject\Service("session")
* @var SessionInterface
*/
private $session;
/**
* @Inject\Parameter("acme_foo")
*/
private $foo;
/**
* @Route("/foo", name="foo")
* @Template
*/
public function indexAction()
{
$foo = $this->session->get($this->foo);
return array(
'foo' => $foo,
);
}
}
How can I help you explore Laravel packages today?