Answer the question
In order to leave comments, you need to log in
How in Laravel when declaring a service provider in AppServiceProvider in $singleton to make lazy loading?
Hello, often you need to declare a singleton service provider in Laravel and a $singleton
class property would be good for this AppServiceProvider
, but, judging by the documentation, the declared providers are loaded there on each request.
Some service providers are not needed on every load, the documentation says to load them by creating a separate file with a service provider class that implements DeferrableProvider . It's not very convenient to create a new file for such a sneeze. Is it possible to somehow do lazy loading of service providers by declaring in some kind of property $singleton AppServiceProvider'а
?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question