PHP Idioms and Patterns
CommunityWrite safer, idiomatic PHP with confidence.
System Documentation
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.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: PHP Idioms and Patterns Download link: https://github.com/irahardianto/awesome-agv/archive/main.zip#php-idioms-and-patterns Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.