Laravelにおける、クラスとファサードの違いをまとめた。
クラス
属性(データ)とメソッド(動作)を持ち、オブジェクトの作成の元となるデータや振る舞いを定義する。オブジェクトは、クラスをインスタンス化することで実体化される。
ファサード
クラスをインスタンス化しなくても、staticメソッドのように、メソッドを実行できるようにしてくれる機能。クラスにアクセスするためのインターフェース。
class.php
// クラス使用
$classA = new ClassA;
$classA -> methodA();
facade.php
// ファサード使用
FacadeClassA::methodA();