Factory method design pattern is the most common design pattern in software engineering. It’s deals with creating object of a class without specified the class name. Just simply think there is a factory of creating object of other classes.
We can see there is two different classes, one is
Student and another is
StudentFactory is the factory of creating object of
StudentFactory has a method called
create() which used to return the object of
Student class. So that we can easily create object of
Student class from
StudentFactory Class. These are the basic concept of Factory method design pattern in PHP.