php-patterns

Installation
SKILL.md

PHP Design Patterns

Before writing code

Fetch live docs: Web-search php design patterns examples for current community patterns and best practices. For Magento-specific patterns, web-search site:developer.adobe.com commerce php development components.

Creational Patterns

Factory

Creates objects without exposing instantiation logic. In Magento, auto-generated Factory classes (SomeModelFactory) create non-injectable objects via $factory->create().

When to use: When you need new instances (entities, models) rather than shared singletons. When the caller shouldn't know the concrete class.

Builder

Constructs complex objects step by step. Magento's SearchCriteriaBuilder, FilterBuilder, SortOrderBuilder follow this pattern.

When to use: When object construction requires many optional parameters or multi-step assembly.

Related skills
Installs
2
GitHub Stars
29
First Seen
Mar 31, 2026