if i created many Facades in Laravel application based on this answer, my application performance comes down?
Asked
Active
Viewed 196 times
1 Answers
2
Facades are only Service Locators, they will not directly influence your application performance, but your services will. The more service providers you have, the more services and classes you have to boot, so, the more memory, disk and processor you'll use to boot your applicatiom, and thus, more time your application will need to boot.
But Laravel has you covered. You can defer
the service instantiation routine in your service providers:
class ServiceProvider {
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = true;
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return array('put-here-your-service-alias');
}
}
And Laravel will only load your service provider when your application really needs to have access to that particular service.

Laurence
- 58,936
- 21
- 171
- 212

Antonio Carlos Ribeiro
- 86,191
- 22
- 213
- 204