php-laravel
Installation
SKILL.md
PHP & Laravel Development
Scoped to framework-level PHP. Work on php-src internals or a native PHP extension is C, not PHP: the ia-c-systems skill covers it, including the Zend API conventions (gen_stub arginfo, the request-scoped allocator, custom object handlers, .phpt).
Code Style
declare(strict_types=1)in every file- Happy path last -- guards and errors first, success at the end. Early returns, no
else. - Comments explain why, never what. Never comment tests. If code needs a "what" comment, rename or restructure.
- No single-letter variables --
$exceptionnot$e,$requestnot$r ?stringnotstring|null. Always specifyvoid. Import classnames, never inline FQN.- Validation uses array notation
['required', 'email']for easier custom rule classes - PHPStan level 8+ (
phpstan analyse --level=8); aim for 9 on new projects.@phpstan-type/@phpstan-paramfor generic collection types. The missing-iterable-value-type check lands at level 6 (and every level above it), so any project at 8+ inherits it: use the generic form on every iterable --@return Collection<int, User>,@param array<int, MyObject>-- and array-shape notationarray{first: SomeClass, second: SomeClass}for fixed-key returns; a bareCollectionorarraywill not clear it.