PHP patterns for strict comparison, unsafe input, sessions, password hashing, and 8.4 to 8.6 changes. Load before any edit to a .php file or composer.json, however small, and for PHP questions.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Php Patterns?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/ku5ic-php-patterns)
---
name: php-patterns
description: PHP patterns for strict comparison, unsafe input, sessions, password hashing, and 8.4 to 8.6 changes. Load before any edit to a .php file or composer.json, however small, and for PHP questions.
---
# PHP patterns
Default assumption: PHP 8.6, per the PHP supported versions page. 8.6, 8.5, and 8.4 have active support, and 8.3 and 8.2 security fixes only, 8.2 until 2026-12-31.
A row applies when the project's `require.php` in `composer.json` allows only versions at or above it.
Laravel is laravel-patterns.
## Reference files
Loading this skill isn't enough. Before your next edit, read the file of every row that matches it. The rules live in those files, and this one only points at them.
| Before | Read |
| ----------------------------------------------------------------------------------------- | -------------------------------------------------------- |
| Writing PHP code, or raising the PHP version | [reference/upgrades.md](reference/upgrades.md) |
| Writing, changing, or reviewing PHP code | [reference/anti-patterns.md](reference/anti-patterns.md) |
| Starting a PHP file, writing a `switch` or `match`, hashing a password, or session config | [reference/practices.md](reference/practices.md) |
| Configuring PHPStan, Psalm, PHP_CodeSniffer, PHP-CS-Fixer, Rector, or `composer audit` | [reference/tooling.md](reference/tooling.md) |