In this tutorial we're going to learn how to use and create your own Laravel facades. https://paulund.co.uk/how-to-create-a-facade-in-laravel#what-is-a-facadeA facade provides a static way of accessing the Laravel service container.

You can access the service container by using the app() or resolve() helper functions, passing in the alias for the class you want to return.

Facades make it easy to test and mock or fake the functionality because we can override the class returned from the service container.

The Laravel abstract facade class comes with a shouldReceive method that will allow you to make sure that the facade is called and how many times.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners