Support the ongoing development of Laravel.io →
IOC Architecture

Hello!

I created some services to my application and i have problem to load this services... First, i created a ServiceProvider ( only resolve bindings) and i bind all services inside this and set $defer=true;

The problem:

When run i get error : Target [...] is not instantiable, this because $defer=true... Looking the laravel documentation i see that's necessary define provides() method when use $defer = true,

Ok, i set my provider with $defer = true, create provides() method, but what i will define inside provides() ? I will define the class that will use my provider (like a controller, another service, some repository)?

Sorry my bad english :D

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

mprandot mprandot Joined 15 Sep 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.