asyrafhussin avatar

Php Best Practices

This is a comprehensive PHP code review ruleset that actually checks your project's PHP version first, then only suggests features you can use. It covers 51 rules across type safety, modern syntax (constructor promotion, enums, match expressions, readonly, property hooks), PSR standards, SOLID principles, and security. The version-gated approach is smart because suggesting PHP 8.4 property hooks to someone on 8.1 wastes everyone's time. It outputs findings in a clean `file:line - [category] issue` format. The quick reference tables are genuinely useful when you're mid-review and need to remember whether intersection types landed in 8.1 or 8.2. Best for teams enforcing modern PHP practices or anyone tired of reviews that ignore half the type system.

skills.sh installs
3.8K
GitHub stars
102
last updated
Aug 21, 2026

Install

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

Installs into .claude/skills of the current project.

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

Sponsors

Details

Repository
github.com/asyrafhussin/agent-skills
Categories
Git & Pull Requests, Code Review & Quality, AI & Agent Building, PHP & Laravel

More from asyrafhussin/agent-skills

All 14
1giuseppe-trisciuoglio avatarsonarqube-mcpgiuseppe-trisciuoglio/developer-kitProvides SonarQube and SonarCloud integration patterns via the Model Context Protocol (MCP) server. Enables quality gate monitoring, issue discovery and triagin3.7Kskills.sh installs
2thedotmack avatarstandupthedotmack/claude-memFacilitate a read-only standup across git worktrees, branches, or PRs to compare changes and produce one consolidation plan.3.7Kskills.sh installs
3everyinc avatarce-simplify-codeeveryinc/compound-engineering-pluginSimplify settled, recently changed code for clarity, reuse, quality, and efficiency while preserving behavior. Use after implementation and before review; use c3.6Kskills.sh installs
4everyinc avatarce-debugeveryinc/compound-engineering-pluginDiagnosis loop for bugs and failing behavior. Use for errors, stack traces, regressions, failed tests, issue-tracker bugs, stuck investigations after failed fix3.6Kskills.sh installs
5bahayonghang avatarpaper-auditbahayonghang/academic-writing-skillsReviewer-style audit and submission gate for academic papers in .tex, .typ, or .pdf. Use for peer-review critique, readiness/gate decisions, blocker triage, rev3.5Kskills.sh installs
6giuseppe-trisciuoglio avataraws-cdkgiuseppe-trisciuoglio/developer-kitProvides AWS CDK TypeScript patterns for defining, validating, and deploying AWS infrastructure as code. Use when creating CDK apps, stacks, and reusable constr3.5Kskills.sh installs