Category: Laravel

When binding services into the container, usually we use the register() method, which is the dedicated method for this. However, there is another quick way to bind services. Let’s take a look, how do we use the register method usually: This is the generic way to register services, and we need to go this way when we want to customize the service a bit. However, when our service is quite simple, we can skip the register method, and use the $bindings and $singletons property: Using this approach, we can clean up our register method a bit. This is useful when we are registering a bunch of different services, so the simpler ones, we can refactor to a property instead of populating the register method more.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners