5 Tips for the Laravel Service Container
Published on by Eric L. Barnes
Mohamed Said published a new video on the Laravel Youtube channel outlining 5 tips for dealing with Laravel's Service Container:
To sum up the tips:
- Avoid executing DB queries in service providers
- Avoid reading session data in service providers
- Avoid resolving bindings in the register method
- Scoped instances vs. Singletons
- Use rebinding events to refresh dependencies
Eric is the creator of Laravel News and has been covering Laravel since 2012.