php-the-right-way
Installation
SKILL.md
Purpose
Guide PHP code to follow modern, idiomatic best practices as defined by the PHP community. Apply these rules when writing, reviewing, or refactoring any PHP code.
Core Rules (always apply)
Version
- Use PHP 8.2+ features; never write PHP 7.x style code for new projects
- Enable strict types:
declare(strict_types=1);at the top of every file
Code Style
- Follow PSR-12 for formatting + PSR-4 for autoloading
- Use Composer for all dependency management — never manual
require - Run
php-cs-fixerorphpcsto enforce style automatically
Comparisons
- Always use strict comparison (
===,!==) — never loose== - Check
strpos(),array_search()etc. with!== false, not truthiness