F
F
Fedooot012021-09-22 10:44:25
Laravel
Fedooot01, 2021-09-22 10:44:25

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 $singletonclass 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

1 answer(s)
F
Fedooot01, 2021-09-22
@Fedooot01

Apparently not.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question