php-guide

Installation
SKILL.md

PHP Guide

Applies to: PHP 8.1+, Web Applications, APIs, CLIs, Microservices

Core Principles

  1. Strict Types Always: Every PHP file starts with declare(strict_types=1)
  2. Type Declarations Everywhere: All parameters, return types, and properties must have type declarations
  3. PSR Standards: Follow PSR-12 coding standard, PSR-4 autoloading, PSR-7 HTTP messages
  4. Composition Over Inheritance: Prefer interfaces, traits, and dependency injection over deep class hierarchies
  5. 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.json with version constraints
  • Run composer validate and composer audit before committing
Related skills
Installs
7
Repository
ar4mirez/samuel
First Seen
Mar 1, 2026