Created
May 22, 2014 10:42
-
-
Save mheap/334add73b5c059240817 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install it | |
Add to composer: | |
"symfony/dependency-injection": "2.4.2", | |
"symfony/yaml": "2.4.2", | |
# Configure it | |
<?php | |
use Symfony\Component\DependencyInjection\ContainerBuilder; | |
use Symfony\Component\Config\FileLocator; | |
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; | |
$container = new ContainerBuilder(); | |
$loader = new YamlFileLoader($container, new FileLocator(__DIR__)); | |
$loader->load('/path/to/definition.yml); | |
return $container; | |
?> | |
# Use it | |
<?php $db = $container->get("db"); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment