PHP Design Patterns
#Design Patterns for PHP
For my own pratice and to help other programmers I decided to implement several Design Patterns in PHP. I hope you like it and you will find it helpful. If you have any suggestions how can I write something better please create pull request or message me
##What are design patterns
Design problems are proven to work solutions for problems that often occur while writing applications.
##Why to use them
Because they solve problems. You do not need to invent solution that is already working. How many times during your programmer career you had this feeling that you already solved problem that you are facing now? Same goes with patterns you have problem that could be solved using specific pattern. Keep in mind that you should not force your code to fit in patterns. It should come out naturally. Firstly K.I.S.S.
- Singleton - One global instance of a class
- Adapter - adapt class behavior to new conditions without modifying source of original class
- Chain of responsibility - Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request
- Memento - Without violating encapsulation, capture and externalize an object's internal state
- Observer - Define one to many dependency between objects so that when one changes state, all its dependents are notified and updated automatically
- Proxy - Do some operations before giving access to origin object
- State - allow object to alter its behavior depending on current internal state change.
- Strategy - Define a family of algorithms and make them interchangeable.
- Decorator - Attach additional object features dynamically without subclassing or modifying source class.
##To be implemented