Giter Club home page Giter Club logo

ahmedelbougha / php-design-patterns Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gabrielanhaia/php-design-patterns

0.0 1.0 0.0 253 KB

Learn how to implement the most important Design Patterns into your PHP application. This project uses PHP 8.1. it has examples for each Pattern and an Article explaining how to use them step by step, their advantages, and disadvantages.

License: MIT License

PHP 95.43% Makefile 4.50% Dockerfile 0.08%

php-design-patterns's Introduction

Logo - PHP 8.1 Design Patterns

Licence Package Stars

Everyweek a new Pattern + Article on www.medium.com/@anhaia.gabriel and www.medium.com/mestredev
Also, you can check Refacroring Guru and Geeks for Geeks for infomration and better understanding of the design patterns.

PHP 8.1 - Design Patterns

This repository was created to show the implementation of a variety of Design Patterns using PHP 8. There is no dependency on a framework, and the examples are the most real as possible based on my own experiences solving real-life problems. Once you learn the design pattern and its concept, it will be effortless to apply it in any PHP project.

Patterns implemented + Article

# ๐Ÿ“– Pattern Code Example / Implementation โœ๏ธ Article / Post ๐Ÿ“š Status
1 Adapter HERE LEARN HERE ๐Ÿ“– and HERE DONE
2 Facade HERE LEARN HERE ๐Ÿ“– and HERE DONE
3 Template Method HERE LEARN HERE ๐Ÿ“–
4 Strategy HERE LEARN HERE ๐Ÿ“–
5 Abstract Factory HERE Soon and HERE DONE
6 Builder HERE Soon
7 Composite HERE Soon
8 Decorator HERE Soon
9 Factory Method HERE Soon and HERE DONE
10 Flyweight HERE Soon
11 Iterator HERE Soon and HERE DONE
12 Memento HERE Soon and HERE DONE
13 Money HERE Soon and HERE DONE
14 Null Object HERE Soon and HERE DONE
15 Observer HERE Soon
16 Prototype HERE Soon and HERE DONE
17 Proxy HERE Soon and HERE DONE
18 Singleton HERE Soon and HERE DONE
19 State HERE Soon

Coming soon

  • Bridge
  • Chain of Responsibility
  • Command
  • Interpreter
  • Mediator
  • Object Pool
  • Visitor

Dependencies

Running the project

I strongly recommend that you follow the articles (links above) and run them with Docker. It will be much easier, and you need to install Docker on your computer, independent of the OS you are using. With a few commands, you will run/test all the Design Patterns implemented throughout the course .

Build de container:

# docker build -t design-patterns . or if you prefer # make build

Run the following commands in order to test the design patterns:

# make help and then you will see the list of commands

You just need to run the command with the pattern you want to test, for example:

# make strategy

Additional Information

  • If you take a look at the examples into the blog, or inside the folders /src/{$pattern_name}/ you will notice that in almost all the examples contain a folder called components, those folders are the files/classes used to demonstrate how to use each pattern. Never consider what is in there as part of the pattern! They are not examples to be followed in your applications.

php-design-patterns's People

Contributors

ahmedelbougha avatar gabrielanhaia avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.