Skip to content

Instantly share code, notes, and snippets.

@kenjis
Last active August 29, 2015 13:57
Show Gist options
  • Save kenjis/9441772 to your computer and use it in GitHub Desktop.
Save kenjis/9441772 to your computer and use it in GitHub Desktop.

There are not a few people who think "Laravel facade" is the same as GoF Facade design pattern, or came from it.

Laravel app class doesn't use static methods. It uses facade design pattern. http://www.sitepoint.com/php-dependency-injection-container-performance-benchmarks/#comment-1540329181

Fortunately, Taylor came up with the wonderful idea of Facade classes, named after the ‘Facade’ design pattern. http://daylerees.com/codebright/architecture

It uses Facade Design Pattern, when you call a static method, actually much more things happen behind the scene than it appears. Lets go through the life cycle of a static call. http://usman.it/laravel-4-uses-static-not-true/

Laravel 4 takes advantage of the Facade Design Pattern , which allows it to provide an expressive syntax through a static API but still keep it testable under the hood. http://stackoverflow.com/questions/17332322/does-facade-in-laravel-4-implement-facade-pattern-can-someone-explain-this-to-m

It uses Facade design pattern, when you call a static method, actually much more things happen behind the scene than it appears. http://heera.it/extend-input-class-laravel-4

Facade is an object-oriented pattern popularized by the Gang of Four that provides an interface to a large body of code, such as a class library. This design pattern is incredible powerful, and is used extensively in the popular PHP framework, Laravel. http://jpbetley.com/the-great-facade/

Laravel 4 takes advantage of Facade Design Pattern[ http://en.wikipedia.org/wiki/Facade_pattern ] which allows it to provide expressive syntax through static API’s but still keep it testable under the hood. http://blog.joynag.net/2013/05/facades-in-laravel-4-and-static-methods-resolution/

Facade Pattern: A guardian that handles a lot of Laravel 4’s internals behind the scenes, but provides a nice API for you. http://www.thenerdary.net/post/30859565484/laravel-4

Without getting too much into it the idea is that all your objects are accessible through what appear to be static method calls using the facade design pattern. http://www.websanova.com/blog/laravel/10-reasons-why-laravel-is-better-than-codeigniter

Design Patterns is a very vast subject. You're already using MVC & Facade just by using Laravel. https://laracasts.com/forum/961-design-patterns/p1#p4435

ファサードはLaravelが創りだした概念というわけではなく、GoFデザインパターン一つのようです。 http://new.takyam.com/entry/2013/07/14/Laravel_4_%E3%81%A7%E4%BD%BF%E3%82%8F%E3%82%8C%E3%81%A6%E3%82%8B_Facade%28%E3%83%95%E3%82%A1%E3%82%B5%E3%83%BC%E3%83%89%29_%E3%81%8C%E7%B4%A0%E6%99%B4%E3%82%89%E3%81%97%E3%81%84%E4%BB%B6

FacadeといえばGoFのデザインパターンにあるFacade(ファサード)ですね。 サブシステムに仕事を投げるメソッドを提供するクラスを作り、サブシステムの独立性を高めるためのパターンです。 http://nextat.co.jp/staff/archives/29

And Taylor Otwell who is a creator of Laravel says:

because programmers are too moronic to possibly understand facades in Laravel aren’t exactly the facade pattern… lol https://twitter.com/taylorotwell/status/441392814291562496

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment