Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Design Pattern in PHP

Design Pattern in PHP

Nemanja Maric

December 25, 2019
Tweet

More Decks by Nemanja Maric

Other Decks in Programming

Transcript

  1. About me • PHP Developer at Abstract • Member of

    PHP Serbia Community • Co-organizer Laravel Serbia Meetup’s • Working with PHP since 2014 • In Laravel world from 2016 • Open source contributor • Contributing to the Laravel Framework • And most !important: Husband and father of two little angels
  2. We need to create a class to allow that two

    totally different interface to communicate
  3. Definition Define family of algorithms, encapsulate each one and then

    make it interchangeable. Leverage polymorphism we are able to swap component in a runtime.
  4. Definition Chain of Responsibility is a behavioral design pattern that

    lets you pass requests along a chain of handlers. Upon receiving a request, each handler decides either to process the request or to pass it to the next handler in the chain.
  5. How to be 100% sure that all item in a

    chain will use our check method?
  6. Definition Decorator is a structural design pattern that lets you

    attach new behaviors to objects by placing these objects inside special wrapper objects that contain the behaviors.