php-patterns

Implements classic design patterns in PHP 8+ projects with Laravel-style modules.

Updated Jan 23, 2026
One-click install
npx skills add https://github.com/VictorSmaniotto/degestao --skill php-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: php-patterns
Source: https://github.com/VictorSmaniotto/degestao/tree/main/.agent/skills/php-patterns
Command: npx skills add https://github.com/VictorSmaniotto/degestao --skill php-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps PHP developers structure applications using classic design patterns to improve maintainability, testability, and scalability.

Core Features & Use Cases

  • Repository Pattern: Abstracts data access and decouples storage from business logic.
  • Service Layer Pattern: Orchestrates business workflows and enforces separation of concerns.
  • Factory, Strategy, Observer, Decorator, Adapter, and Specification: Provide flexible object creation, interchangeable algorithms, event-driven behavior, and composable business rules.
  • Use Case: Apply to enterprise PHP apps (e.g., Laravel) to organize modules, reduce coupling, and enable easier testing.

Quick Start

Implement the patterns in a PHP project by following the examples to structure repositories, services, factories, strategies, and specifications.

Frequently Asked Questions about php-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a PHP application using the repository and service layer patterns?

To structure PHP applications with the repository and service layer patterns, you abstract data access into repositories and orchestrate business workflows in services, enforcing separation of concerns and decoupling storage from business logic.

What is the best way to decouple business logic from data access in enterprise PHP projects?

The best way to decouple business logic from data access in enterprise PHP projects is applying classic design patterns like repositories and service layers, ensuring decoupled data access, testability, and adherence to SOLID principles.

How do I implement the strategy and specification patterns in PHP 8+?

To implement the strategy and specification patterns in PHP 8+, you define interfaces for interchangeable algorithms and composable business rules, enabling flexible object creation and extensible architecture while maintaining PHP 8+ compatibility.

Can I use these PHP design patterns to organize Laravel-style modules?

Yes, you can use these PHP design patterns to organize Laravel-style modules in enterprise applications, reducing coupling and enabling easier testing by structuring repositories, services, factories, and observers.

When should I use the factory and decorator patterns in my PHP architecture?

You should use the factory and decorator patterns in PHP architecture when you need flexible object creation and want to add event-driven behavior or responsibilities dynamically without modifying existing business logic structures.