php-guide
Installation
SKILL.md
PHP Guide
Applies to: PHP 8.1+, Web Applications, APIs, CLIs, Microservices
Core Principles
- Strict Types Always: Every PHP file starts with
declare(strict_types=1) - Type Declarations Everywhere: All parameters, return types, and properties must have type declarations
- PSR Standards: Follow PSR-12 coding standard, PSR-4 autoloading, PSR-7 HTTP messages
- Composition Over Inheritance: Prefer interfaces, traits, and dependency injection over deep class hierarchies
- Modern PHP First: Use PHP 8.1+ features (enums, readonly properties, fibers, named arguments, match expressions)
Guardrails
Version & Dependencies
- Target PHP 8.1+ (enums, readonly properties, fibers, intersection types)
- Define all dependencies in
composer.jsonwith version constraints - Run
composer validateandcomposer auditbefore committing
Related skills