Created
September 18, 2012 07:54
-
-
Save davedevelopment/3741881 to your computer and use it in GitHub Desktop.
Silex DI
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
| /** | |
| * The Application(which is an instance of Pimple) sets up it's required dependencies, one of which is a logger | |
| */ | |
| $this['logger'] = null; | |
| /** snip */ | |
| /** | |
| * The controller resolver takes an optional logger | |
| */ | |
| $this['resolver'] = $this->share(function () use ($app) { | |
| return new ControllerResolver($app, $app['logger']); | |
| }); | |
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
| /** | |
| * Providers get passed the Application instance to register their services (and their dependencies) | |
| * | |
| * The Monolog provider adds it's own services to the container, and then overrides default logger | |
| */ | |
| $app['logger'] = function () use ($app) { | |
| return $app['monolog']; | |
| }; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment