domnikl/design-patterns-php
Composer 安装命令:
composer require domnikl/design-patterns-php
包简介
Sample code for several design patterns in PHP
README 文档
README
Read the Docs of DesignPatternsPHP or Download as PDF/Epub
This is a collection of known design patterns and some sample codes on how to implement them in PHP. Every pattern has a small list of examples.
I think the problem with patterns is that often people do know them but don't know when to apply which.
Installation
You should look at and run the tests to see what happens in the example.
To do this, you should install dependencies with Composer first:
$ composer install
Read more about how to install and use Composer on your local machine here.
To run the tests use phpunit:
$ ./vendor/bin/phpunit
Using Docker (optional)
You can optionally build and browse the documentation using Docker for Mac, Windows or Linux.
Just run:
$ docker-compose up --build
Go to http://localhost:8080/ to read the generated documentation.
If you want to localize your documentation you can pass the locale as an argument to the docker build:
$ docker-compose build --build-arg language=de $ docker-compose up
Patterns
The patterns can be structured in roughly three different categories. Please click on the 📓 for a full explanation of the pattern on Wikipedia.
Creational
- AbstractFactory 📓
- Builder 📓
- FactoryMethod 📓
- Pool 📓
- Prototype 📓
- SimpleFactory
- Singleton 📓
- StaticFactory
Structural
- Adapter 📓
- Bridge 📓
- Composite 📓
- DataMapper 📓
- Decorator 📓
- DependencyInjection 📓
- Facade 📓
- FluentInterface 📓
- Flyweight 📓
- Proxy 📓
- Registry 📓
Behavioral
- ChainOfResponsibilities 📓
- Command 📓
- Interpreter 📓
- Iterator 📓
- Mediator 📓
- Memento 📓
- NullObject 📓
- Observer 📓
- Specification 📓
- State 📓
- Strategy 📓
- TemplateMethod 📓
- Visitor 📓
More
Localization & Supported Languages
| Code | Language | Documentation |
|---|---|---|
| ca | Catalan | Docs 📓 |
| zh_CN | Chinese | Docs 📓 |
| nl | Dutch | Docs 📓 |
| en | English | Docs 📓 |
| de | German | Docs 📓 |
| ja | Japanese | Docs 📓 |
| pl | Polish | Docs 📓 |
| pt_BR | Portuguese-Brazil | Docs 📓 |
| ru | Russian | Docs 📓 |
| es | Spanish | Docs 📓 |
| es_MX | Spanish-Mexican | Docs 📓 |
| tr | Turkish | Docs 📓 |
| bg | Bulgarian | Docs 📓 |
| fr | French | Docs 📓 |
| it | Italian | Docs 📓 |
domnikl/design-patterns-php 适用场景与选型建议
domnikl/design-patterns-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.17k 次下载、GitHub Stars 达 20.86k, 最近一次更新时间为 2015 年 03 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 domnikl/design-patterns-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 domnikl/design-patterns-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.17k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 20865
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-03-05