Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

TutsPlus.com:
What Are Laravel 5.0 Facades?
Feb 23, 2016 @ 18:22:49

The TutsPlus.com site has posted a tutorial for those either new to the Laravel framework or wanting to get started a bit easier. In this new post they talk about the "facades" the framework makes wide use of - what they are and how they work.

The facade is very similar to the adapter and decorator patterns. The adapter acts like a bridge between two interfaces which are not compatible, while the decorator is more complex and used for dynamically changing the way objects behave.

[...] Sweet syntax, which Laravel uses, makes writing code cleaner and easier to understand. Laravel facades are actually the syntactic sugar for service location.

He uses the Cache facade in his introduction, showing where the various parts of it are defined and how it hooks in to the framework's functionality. With the basics out of the way he then shows how to create a custom facade instance: a simple check to see if the file name provided is a PDF or not.

tagged: laravel facade introduction tutorial custom pdf file

Link: http://code.tutsplus.com/tutorials/what-are-laravel-50-facades--cms-25347


Trending Topics: