PHP Design Patterns

Design Patterns : Patterns are ways to describe best practices and good designs. They show a flexible solution to common programming problems.   Factory Pattern : The Factory pattern allows for the instantiation of objects at runtime. It is called a Factory Pattern since it is responsible for “manufacturing” an object. A Parameterized Factory receives the name of the class to instantiate as argument.   Example : <?php class Example { // The parameterized factory method public static function factory($type) { if (include_once ‘Drivers/’ . $type . ‘.php’) { $classname…

Read More