0
0

More than 1 year has passed since last update.

Laravelにおけるクラスとファサードの違い

Posted at

Laravelにおける、クラスとファサードの違いをまとめた。

クラス

属性(データ)とメソッド(動作)を持ち、オブジェクトの作成の元となるデータや振る舞いを定義する。オブジェクトは、クラスをインスタンス化することで実体化される。

ファサード

クラスをインスタンス化しなくても、staticメソッドのように、メソッドを実行できるようにしてくれる機能。クラスにアクセスするためのインターフェース。

class.php
// クラス使用
$classA = new ClassA;
$classA -> methodA();
facade.php
// ファサード使用
FacadeClassA::methodA();
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0