Laravel Tutorials

5 Tips for the Laravel Service Container

Published
5 Tips for the Laravel Service Container image

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

Eric is the creator of Laravel News and has been covering Laravel since 2012.

Sponsored

serpapi logo
SerpApi

The Web Search API for Your LLM and AI Applications

Visit SerpApi

The latest

View all →
Image Dominant Color and HEIC Support in Laravel 13.24 image

Image Dominant Color and HEIC Support in Laravel 13.24

Read article
Official Laravel Zed Extension: LSP for PHP & Blade image

Official Laravel Zed Extension: LSP for PHP & Blade

Read article
Laravel Head: Manage Meta Tags, Open Graph, and JSON-LD image

Laravel Head: Manage Meta Tags, Open Graph, and JSON-LD

Read article
PhpStorm 2026.2 Released image

PhpStorm 2026.2 Released

Read article
Laravel Doctor: Diagnose Your App With One Artisan Command image

Laravel Doctor: Diagnose Your App With One Artisan Command

Read article
CPX: The Composer Package Executor for PHP image

CPX: The Composer Package Executor for PHP

Read article