php-guide

Guide PHP 8.1+ development with strict typing and PSR standards.

7|1|Updated Nov 3, 2025
One-click install
npx skills add https://github.com/ar4mirez/samuel --skill php-guide
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: php-guide
Source: https://github.com/ar4mirez/samuel/tree/main/template/.claude/skills/php-guide
Command: npx skills add https://github.com/ar4mirez/samuel --skill php-guide

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides comprehensive guardrails, patterns, and best practices for modern PHP development, ensuring code quality, maintainability, and adherence to standards.

Core Features & Use Cases

  • Enforces Strict Typing: Guides developers to use type declarations everywhere.
  • Adheres to PSR Standards: Promotes PSR-12 coding style and PSR-4 autoloading.
  • Modern PHP Features: Demonstrates idiomatic use of Enums, Readonly Classes, Match Expressions, and more.
  • Robust Error Handling: Outlines strategies for domain-specific exceptions and avoiding common pitfalls.
  • Testing & Tooling: Provides guidance on PHPUnit, PHPStan, and PHP-CS-Fixer configurations.
  • Use Case: When starting a new PHP project or refactoring an existing one, this Skill acts as a definitive guide to ensure the codebase is clean, secure, and follows industry best practices.

Quick Start

Review the PHP guide to understand the core principles and guardrails for developing with PHP 8.1+.

Frequently Asked Questions about php-guide

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What are the best practices for modern PHP development?

PHP strict typing requires declaring types for all function parameters and return values. This practice prevents type coercion bugs and enforces robust domain-specific error handling in PHP 8.1+.

How do I configure PHPStan and PHPUnit for a new project?

PHP error handling best practices involve creating domain-specific exceptions and avoiding common pitfalls. Structuring errors logically ensures robust application flow and secure web applications.

How do I implement modern PHP features like enums and readonly classes?

PSR-12 coding style enforces consistent formatting and structure across PHP codebases. Following PSR standards ensures readability and industry-standard compliance for web applications and microservices.

Does this PHP guide support older PHP versions?

Securing PHP microservices involves following strict guardrails and domain-specific error handling. This guide outlines security patterns and project structures tailored for APIs and microservices.

What's the best way to structure a PHP application for maintainability?

Refactoring legacy PHP involves applying strict type declarations, modernizing error handling, and adopting PSR-12 standards. This guide acts as a definitive reference for upgrading codebases.