The official docs say:
If you open the config/app.php file included with Laravel, you will see a providers array. These are all of the service provider classes that will be loaded for your application. Of course, many of these are "deferred" providers, meaning they will not be loaded on every request, but only when the services they provide are actually needed.
and
If your provider is only registering bindings in the service container, you may choose to defer its registration until one of the registered bindings is actually needed. Deferring the loading of such a provider will improve the performance of your application, since it is not loaded from the filesystem on every request.
How can I know if a package uses a "deferred" service provider that will not be loaded on every request?
If the defer property is not set, what default value is implied?
...and in the cached manifest at bootstrap/cache/services.php what is the difference between providers, eager, deferred and when?
This is for know if a package will be bootstrapped for all requests or if it will be "loaded" only when the package functionalities will be called. In this way, I will avoid some packages that add extra features that I don't want in favor of my code (for performance reason)
So, how know if a package will be heavy for the entire application or not?
For example, I want to use the "cviebrock/eloquent-sluggable" package that is very simple and uses trait for add functionalities in the model. But also implements a service provided with bindings that will be used in an observer, how I know if this will be loaded only when I save or edit models?
Thanks.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire