Created
December 20, 2011 12:53
-
-
Save thiagophx/1501488 to your computer and use it in GitHub Desktop.
Dependency Injection on .ini Files
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
; services.ini | |
[userService MyApp\Service\UserService] | |
options = [appContainer] | |
serviceLocator = [this] | |
; application.ini | |
; App configuration | |
url = "http://www.google.com" | |
db_host = "127.0.0.1" | |
dados = [[url], [db_host]] | |
appConfig = SETTINGS_PATH | |
[serviceLocator Respect\Config\Container] | |
appContainer = [dados] | |
loadFile[] = "[appConfig]services.ini" | |
<?php | |
$c = new Respect\Config\Container(SETTINGS_PATH . 'application.ini'); | |
var_dump($c->serviceLocator->userService); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment