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

laravelcloud logo
Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Visit Laravel Cloud

The latest

View all →
Laravel Auditor Audits Your App With Your Own AI Agent image

Laravel Auditor Audits Your App With Your Own AI Agent

Read article
A simple form builder that stays out of your way image

A simple form builder that stays out of your way

Read article
Laravel AI: Trace Agent Runs With Lifecycle Events image

Laravel AI: Trace Agent Runs With Lifecycle Events

Read article
Laravel AI: Get Raw HTTP Responses and Rate Limits image

Laravel AI: Get Raw HTTP Responses and Rate Limits

Read article
Agent Run Observability in Laravel AI SDK 0.11 image

Agent Run Observability in Laravel AI SDK 0.11

Read article
Debounced Queued Event Listeners in Laravel image

Debounced Queued Event Listeners in Laravel

Read article