PHP Template Method Generator

•
45
•

Generates PHP 8.4 Template Method pattern structures to define algorithm skeletons with customizable steps and built-in unit tests.

This skill automates the implementation of the Template Method design pattern within PHP 8.4 environments, specifically optimized for Domain-Driven Design (DDD) and Clean Architecture. It generates abstract algorithm skeletons that enforce a specific execution flow while providing protected hook methods for concrete subclasses to override. By utilizing PHP 8.4 features like readonly classes and strict typing, it ensures that shared logic remains invariant while allowing for flexible extension in scenarios like multi-format data importing, report generation, or complex order processing workflows.

主要功能

01Generates PHP 8.4 readonly abstract classes and concrete implementations
02Prevents common anti-patterns like deep inheritance and public template steps
03Implements customizable hook methods for optional algorithm extension points
04Supports DDD-compliant folder structures and naming conventions
0545 GitHub stars
06Provides automated unit test generation for both skeletons and variants

使用场景

01Standardizing multi-format data importers (CSV, JSON, XML) with shared validation
02Building report generation systems with variant-specific output formats
03Implementing complex business workflows like order processing with type-specific steps