Coder Social home page Coder Social logo

design_patterns's Introduction

PHP设计模式

代码实现均在Yjc目录,测试代码在App里。

本库是学习PHP设计模式所写的测试代码。核心代码均在Yjc目录里。为了测试方便,其实已经完成了简单的MVC框架的封装。

大家可以按照下面的文档进行测试,然后看代码实现。本人水平有限,欢迎提出修改建议。

设计模式

创建模式

架构模式

行为模式

开始测试

需要有运行环境。使用PHP7的同学可以直接使用下面的方法开启Server,免去Nginx配置PHP环境烦扰。

开启server

php -S 0.0.0.0:8888

浏览器输入:http://localhost:8888

设计模式测试

简单工厂

/SimpleFactoryTest/index

示例:
URL路径:http://localhost:8888/SimpleFactoryTest/index
对应文件:App/SimpleFactoryTest
对应源码:Yjc/SimpleFactory

工厂方法

/FactoryTest/index

抽象工厂

/AbstractFactoryTest/index

单例模式

/SingletonTest/index

注册树模式

/RegisterTest/index

原型模式

/PrototypeTest/index

适配器模式

/AdapterTest/index
AdapterTest/index2

装饰器模式

/DecoratorTest/index

策略模式

/StrategyTest/index

观察者模式

/Observertest/index

迭代器模式

/IteratorTest/index

design_patterns's People

Contributors

52fhy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.