
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-codeInstalls 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
More from asyrafhussin/agent-skills
All 14- React Vite Best Practices3K
- Laravel Best Practices2.4K
- Laravel Inertia React2K
- Clean Code Principles1.9K
- Typescript React Patterns1.1K
- Laravel Database Optimization1.1K
- Laravel Owasp Security1.1K
- Tailwind Best Practices1K
- Api Design Patterns984
- Testing Best Practices957
- Web Design Guidelines948
- Git Workflow890
- State Management834