php-laravel

Installation
SKILL.md

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
  • Static analysis: run PHPStan at level 8+ (phpstan analyse --level=8). Aim for level 9 on new projects. Use @phpstan-type and @phpstan-param for generic collection types.

Modern PHP (8.4)

Use these when applicable -- do not add explanatory comments in generated code (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
Related skills
Installs
29
GitHub Stars
11
First Seen
Feb 22, 2026