Skip to content

Instantly share code, notes, and snippets.

@carteni
Last active May 30, 2017 10:08
Show Gist options
  • Save carteni/3480d9ae6662995d42aa524c99996de2 to your computer and use it in GitHub Desktop.
Save carteni/3480d9ae6662995d42aa524c99996de2 to your computer and use it in GitHub Desktop.
Symfony Dependency Injection. Simple ClosureLoader usage.
<?php
namespace Symfony\Component\DependencyInjection\Loader
{
$resource = function ($container) {
$config = new namespace\AppBundle\DI\ClosureConfig();
$config($container);
};
$loader->resolve($resource, null)->load($resource, null);
}
namespace Symfony\Component\DependencyInjection\Loader\AppBundle\DI
{
class ClosureConfig
{
public function __invoke($container)
{
$container->setParameter("app.config.closure", "value");
}
}
}
imports:
- { resource: config.php }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment