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 L. Barnes photo](https://laravel-news.com/storage/profile-photos/YlkXwoKe1xHNPfmxXdAbBIeCqg9kFE7CtyKySeI1.jpg)
Eric is the creator of Laravel News and has been covering Laravel since 2012.