← ClaudeAtlas

php-laravellisted

Modern PHP 8.2+ and Laravel patterns: architecture, Eloquent, queues, Pest testing. Use when asked to "write PHP", "build a Laravel app", "fix Eloquent query", "add a queue job", "write a Pest test", or mentions PHP, Laravel, Eloquent, Blade, artisan, or migrations.
iliaal/whetstone · ★ 20 · AI & Automation · score 81
Install: claude install-skill iliaal/whetstone
# PHP & Laravel Development ## Code Style - `declare(strict_types=1)` in every file - Happy path last — handle errors/guards first, success at the end. Use early returns; avoid `else`. - Comments only explain *why*, never *what*. Never comment tests. If code needs a "what" comment, rename or restructure instead. - No single-letter variables — `$exception` not `$e`, `$request` not `$r` - `?string` not `string|null`. Always specify `void`. Import classnames everywhere, never inline FQN. - Validation uses array notation `['required', 'email']` for easier custom rule classes ## Modern PHP (8.2+) Use these when applicable — do not explain them in comments (Claude and developers know them): - Readonly classes and properties for immutable data - Enums with methods and interfaces for domain constants - Match expressions over switch - Constructor promotion with readonly - First-class callable syntax `$fn = $obj->method(...)` - Fibers for cooperative async when Swoole/ReactPHP not available - DNF types `(Stringable&Countable)|null` for complex constraints ## Laravel Architecture - **Fat models, thin controllers** — controllers only: validate, call service/action, return response - **Service classes** for business logic with readonly DI: `__construct(private readonly PaymentService $payments)` - **Action classes** (single-purpose invokable) for operations that cross service boundaries - **Form Requests** for all validation — never validate inline in controllers - **Events + Listen