What is a Factory Design Pattern in PHP?

A factory creates an object. So, if you wanted to build class A{ public $classb; public $classc; public function __construct($classb, $classc) { $this->classb = $classb; $this->classc = $classc; } } You wouldn’t want to rely on having to do the following code everytime you create the object $obj = new ClassA(new ClassB, new Class C); … Read more