← ClaudeAtlas

laravel-10-noteslisted

Laravel 10.x (February 2023) signature features and the breaking-change traps from 9 → 10. Use when writing or reviewing code in a Laravel 10 project, or in a package whose composer constraint includes ^10.0. Covers native return types throughout the app skeleton, invokable validation rules via the ValidationRule contract, the Process facade for shell invocation, the Pest-as-default test option, and the Predis 2.x default.
hmj1026/dhpk · ★ 1 · AI & Automation · score 72
Install: claude install-skill hmj1026/dhpk
# Laravel 10 — native types, invokable rules, Process facade Released February 2023. PHP 8.1+ floor. --- ## Signature features ### Native return types in app skeleton Generated artifacts now include native PHP type declarations everywhere: ```php // Before (Laravel 9 generator) public function index() { return view('users.index'); } // After (Laravel 10 generator) public function index(): View { return view('users.index'); } ``` The framework itself also typed previously-untyped public methods. Most of these don't break user code, but **strict child classes** that override framework methods may now produce LSP errors. Audit point: a Laravel 9 → 10 upgrade should run static analysis (PHPStan / Psalm) to catch override signature drift. ### Invokable validation rules ```php final class OrderHasStockRule implements ValidationRule { public function validate(string $attribute, mixed $value, Closure $fail): void { if (! Stock::availableFor($value)) { $fail('The :attribute references an out-of-stock SKU.'); } } } // Usage $request->validate(['sku' => ['required', new OrderHasStockRule]]); ``` Replaces the older `Rule` interface (still works, deprecated). Cleaner signature; closure-based failure reporting; testable in isolation. ### Process facade ```php $result = Process::run('ls -la'); if ($result->successful()) { echo $result->output(); } else { Log::error('ls failed', ['code' => $result->exitCode(), 'err' => $