# Refactoring.Guru Design Patterns Examples

Design Pattern Examples in PHP

Repository: https://github.com/RefactoringGuru/design-patterns-php
Canonical: https://ross.abutalabs.com/products/refactoringguru-design-patterns-examples
Homepage: https://refactoring.guru/design-patterns/php
Language: PHP
License: NOASSERTION
License Family: other
Topics: design-patterns, php
Last push: 2026-08-08T06:31:32+00:00
Link (homepage): https://refactoring.guru/design-patterns/php
Link (site_page): https://refactoring.guru/refactoring/techniques/moving-features-between-objects
Link (site_page): https://refactoring.guru/site-about

## Health v2 (maintenance only)
Score: 75/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 96, release rhythm 35, longevity 100
- inputs: {"age_days": 3274, "days_push": 25, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases, no_license
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1068, forks 172 (observed 2026-08-28T04:03:27.402413+00:00)

## What it is
A collection of example implementations of all classic GoF design patterns in TypeScript, Java, and PHP, part of the Refactoring.Guru educational project. Each pattern includes a conceptual example showing internal structure and a real-world example demonstrating practical usage in web applications.

## Use cases
- learn design patterns with runnable code examples
- see how the singleton pattern is implemented in TypeScript
- study real-world examples of the builder pattern
- refresh my knowledge of GoF patterns before an interview
- find reference implementations of adapter and decorator patterns
- teach design patterns to a team with commented examples

## When to choose
- you want clear, well-commented examples of classic design patterns in TypeScript, Java, or PHP
- you are learning or teaching object-oriented design and want both conceptual and real-world code
- you want to accompany the free Refactoring.Guru pattern catalog with runnable code

## When to avoid
- you need a production-ready pattern library or framework to import into your project
- you need code you can redistribute or modify commercially, since the content is CC BY-NC-ND licensed
- you work in a language other than TypeScript, Java, or PHP

## Facets
- artifact type: learning-resource
- maturity: active
- function: developer-tools, documentation
- domain: developer-tools, tutorials, programming-languages
- platform: cross-platform, cli
- tags: design-patterns, gof-patterns, typescript, java, php, educational-examples, refactoring-guru, software-architecture, nodejs

## Member repositories
- RefactoringGuru/design-patterns-php (examples) score 75
- RefactoringGuru/design-patterns-typescript (examples) score 67
- RefactoringGuru/design-patterns-java (examples) score 67

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:27.402413+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T04:35:49.980548+00:00, confidence not recorded.
  - readme: https://github.com/RefactoringGuru/design-patterns-php (fetched 2026-08-28T04:03:27.402413+00:00, sha 47853f991507)
  - homepage: https://refactoring.guru/design-patterns/php (fetched 2026-08-29T11:45:29.040287+00:00, sha c1065d679c09)
  - site_page: https://refactoring.guru/refactoring/techniques/moving-features-between-objects (fetched 2026-08-29T11:45:29.049446+00:00, sha 0e6e58b1770c)
  - site_page: https://refactoring.guru/site-about (fetched 2026-08-29T11:45:29.052158+00:00, sha bba3085229af)
- Data as of 2026-08-30T08:39:29.467469+00:00.
