New advertisers: 50% off your first month with code FIRSTMONTHSee slots
asyrafhussin avatar

Php Best Practices

PHP 8.x modern patterns, PSR standards, and SOLID rules for reviewing and auditing PHP code.

skills.sh installs
3.9K
GitHub stars
105
last updated
Aug 21, 2026
View on GitHub

What it does

  • Covers 51 rules in seven categories: type system, modern features, PSR, SOLID, errors, performance, and security
  • Requires detecting the project's PHP version from composer.json and php -v before suggesting any syntax
  • Lists version-gated features from 8.0 through 8.5, such as enums, readonly classes, property hooks, and the pipe operator
  • Designed for reviewing PHP code, checking type safety, and auditing code quality against the rule set

Install

$ npx -y skills add asyrafhussin/agent-skills --skill php-best-practices -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

PHP Best Practices

Modern PHP 8.x patterns, PSR standards, type system best practices, and SOLID principles. Contains 51 rules for writing clean, maintainable PHP code.

Step 1: Detect PHP Version

Always check the project's PHP version before giving any advice. Features vary significantly across 8.0 - 8.5. Never suggest syntax that doesn't exist in the project's version.

Check composer.json for the required PHP version:

{ "require": { "php": "^8.1" } }   // -> 8.1 rules and below
{ "require": { "php": "^8.3" } }   // -> 8.3 rules and below
{ "require": { "php": ">=8.4" } }  // -> 8.4 rules and below

Also check the runtime version:

php -v   # e.g. PHP 8.3.12

Feature Availability by Version

Details

Repository
github.com/asyrafhussin/agent-skills
Categories
PHP & Laravel, Code Review & Quality

More from asyrafhussin/agent-skills

All 14

Similar to Php Best Practices

More PHP & Laravel