What problem does it solve?
This Skill helps you avoid non-idiomatic or fragile PHP patterns by standardizing modern PHP practices that improve type safety, immutability, and maintainability.
Core Features & Use Cases
- Modern PHP 8.x language features: enforce strict types, use enums for domain constants, prefer readonly DTOs, and improve clarity with named arguments and match expressions.
- Robust error handling: encourage domain exception hierarchies, avoid overly broad exception catching, and require type-safe return values.
- Clean interfaces and dependency injection: define interfaces at consumption points and inject dependencies through constructors.
- Consistent conventions and quality gates: align naming and autoloading with PSR-12/PSR-4, and back changes with PHPUnit/Pest plus static analysis and security checks.
Use cases include greenfield service design, refactoring legacy PHP code toward stricter typing, and improving reliability of feature modules with consistent testing, logging, and analysis.
Quick Start
Use the PHP idioms and patterns skill to refactor your PHP files to use strict types, typed DTOs, enums, domain exceptions, PSR-12 naming, and static analysis checks.