Skip to content
This repository has been archived by the owner on Sep 14, 2018. It is now read-only.

what's the intended way to configure service providers? #81

Open
jdmcalee opened this issue Apr 6, 2017 · 2 comments
Open

what's the intended way to configure service providers? #81

jdmcalee opened this issue Apr 6, 2017 · 2 comments

Comments

@jdmcalee
Copy link

jdmcalee commented Apr 6, 2017

I just started moving a prototype app from Slim to Silex, and I started with this skeleton. It seems strange to load config after initializing the app, though. How are you supposed to configure service providers, Monolog for example, with this layout?

@patrick-fls
Copy link

Special cases like monolog or the web debug toolbar can are configured in the config file themselves as they are part of the environment. You can see it in the skeleton, the dev.php contains monolog, but not the prod.php file

Usually, none of the environment logic is required to register a service, however, and since the providers are lazy loaded in the service container, they will only be instantiated when you call them for the first time (and the config file will then be available to you).

@bezin
Copy link

bezin commented May 19, 2017

Since exactly the same question led me here and to #65 eventually, I'll just leave this here as a reference for future Silex beginners ;)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants