PHPackages                             jpher/design-patterns - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. jpher/design-patterns

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jpher/design-patterns
=====================

code design patterns PHP

0.2.8(9y ago)0201MITPHPPHP &gt;=7.0

Since Dec 16Pushed 9y ago1 watchersCompare

[ Source](https://github.com/jpher/designPatterns)[ Packagist](https://packagist.org/packages/jpher/design-patterns)[ Docs](https://github.com/jpher/designPatterns)[ RSS](/packages/jpher-design-patterns/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (1)Versions (22)Used By (0)

设计模式
====

[](#设计模式)

### 资源列表

[](#资源列表)

- [domnikl/DesignPatternsPHP](https://github.com/domnikl/DesignPatternsPHP)
- [TIGERB/easy-tips](https://github.com/TIGERB/easy-tips)
- [hoohack/DesignPattern](https://github.com/hoohack/DesignPattern)

### 六大原则

[](#六大原则)

- 单一职责原则：`即一个类只负责一项职责`
- 里氏替换原则：`超类（父类）出现的地方，派生类（子类）都可以出现`
- 依赖倒置原则：`抽象不应该依赖细节；细节应该依赖抽象`
- 接口隔离原则: `使用多个接口，而不是对一个接口编程，去依赖降低耦合`
- 迪米特法则：`一个对象应该对其他对象保持最少的了解`
- 开闭原则：`对扩展开放，对修改关闭`

> **`总结: 核心：高内聚松耦合（单一职责），外部依赖，实体对抽象编程，抽象就是分层`**

### 模式类型

[](#模式类型)

- 创建型
    - [抽象工厂](AbstractFactory/)
    - [构建器](Build/)
    - [工厂方法](FactoryMethod/)
    - [多例模式](Multiton/)
    - [资源池模式](Pool/)
    - [原型模式](Prototype/)
    - [简单工厂](SimpleFactory/)
    - [单例模式](Singleton/)
    - [静态工厂](StaticFactory/)
- 结构型
    - [适配器模式](Adapter/)
    - [桥接模式](Bridge/)
    - [组合模式](Composite/)
    - [映射模式](DataMapper/)
    - [装饰模式](Decorator/)
    - [依赖注入](DependencyInjection/)
    - [外观模式](Facade/)
    - [流模式](FluentInterface/)
    - [享元模式](Flyweight/)
    - [代理模式](Proxy/)
    - [注册模式](Registry/)
- 行为型
    - [责任链模式](ChainOfResponsibilities/)
    - [命令模式](Command/)
    - [迭代器模式](Iterator/)
    - [中介者模式](Mediator/)
    - [备忘录模式](Memento/)
    - [空对象模式](NullObject/)
    - [观察者模式](Observer/)
    - [解释器模式](Specification/)
    - [状态模式](State/)
    - [策略模式](Strategy/)
    - [模板方法](Template/)
    - [访问者模式](Visitor/)

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

20

Last Release

3447d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/19968650?v=4)[jpher](/maintainers/jpher)[@jpher](https://github.com/jpher)

---

Top Contributors

[![jpher](https://avatars.githubusercontent.com/u/19968650?v=4)](https://github.com/jpher "jpher (39 commits)")

---

Tags

design patterns php

### Embed Badge

![Health badge](/badges/jpher-design-patterns/health.svg)

```
[![Health](https://phpackages.com/badges/jpher-design-patterns/health.svg)](https://phpackages.com/packages/jpher-design-patterns)
```

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.2k532.1M2.5k](/packages/aws-aws-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k34](/packages/neuron-core-neuron-ai)[google/cloud-core

Google Cloud PHP shared dependency, providing functionality useful to all components.

346132.9M110](/packages/google-cloud-core)[spatie/laravel-export

Create a static site bundle from a Laravel app

673139.5k6](/packages/spatie-laravel-export)[razorpay/ifsc

Razorpay IFSC Codes Library

385204.4k](/packages/razorpay-ifsc)[anthropic-ai/sdk

Anthropic PHP SDK

163372.1k15](/packages/anthropic-ai-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
