Skip to content

Instantly share code, notes, and snippets.

View tveronesi's full-sized avatar
🏠
Working from home

TMV tveronesi

🏠
Working from home
View GitHub Profile
@tveronesi
tveronesi / laravel_facades.md
Created February 6, 2019 22:10 — forked from poing/laravel_facades.md
Laravel Facades

Understanding Facades in Laravel

What's a Facade?

The Laravel explination, shown below is confusing.

Facades provide a "static" interface to classes that are available in the application's service container. Laravel ships with many facades which provide access to almost all of Laravel's features. Laravel facades serve as "static proxies" to underlying classes in the service container, providing the benefit of a terse, expressive syntax while maintaining more testability and flexibility than traditional static methods.

Many examples use Cache::get('key') to demonstrate how a Facade works. Comparing the following code to the utility that a Facade provides.