Created
June 22, 2017 17:46
-
-
Save devmsh/a622df456a6cc70ca2a95aa0d08b382e 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
| <?php | |
| class Container | |
| { | |
| public function make($className){} | |
| public function register($className, $callback){} | |
| } | |
| // initialize the container and register some classes | |
| $c = new Container(); | |
| $c->register(FacebookSDK::class,function(){ | |
| return new FacebookSDK([ | |
| "app_key" => env('FB_APP_KEY'), | |
| "app_secret" => env('FB_APP_SECRET') | |
| ]); | |
| }); | |
| // let the container return some registered classes (e.g. within the controller) | |
| $fb = $c->make(FacebookSDK::class); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment