A FIELD GUIDE TO LARAVEL · VOLUME II · THE ECOSYSTEM
ENTRY II.33 · LIVE VALIDATION
Precognition
Package · first recorded 1 November 2022, first npm packages on npm
Live validation without a second copy of the rules. A precognitive request runs the route's middleware and form request, then stops before the controller, so the frontend learns what the server would say before the real submit.
Specification
Kind Framework middleware plus npm helpers; no package to require
Protocol HTTP, flagged by a Precognition request header; Axios underneath
Client laravel-precognition-vue, -react, -alpine; Inertia 2.3 has it built in
Installed by HandlePrecognitiveRequests on the route · npm i laravel-precognition-*
Voice none: no artisan commands
Scales by A debounced request per changed field; validate({only: [...]}) per step
Range Cloud: yes. Ordinary requests, nothing resident
Forge, VPS: yes, the same requests
Vapor: yes, the same requests
Neighbours
Livewire validates its own components live, so it needs no Precognition. Inertia's form helper has Precognition built in from Inertia 2.3. Rules copied into the browser answer without a round trip but are a second copy; Precognition asks the form request itself, so uniqueness and other database checks are covered.
Field marks
HandlePrecognitiveRequests::class
laravel-precognition-vue (npm)
$request->isPrecognitive()
->withPrecognition() in tests
Fig. II.33.1 · one field, validated early
Parts
1 Input change. @change="form.validate('email')"; the helper debounces and sends the current form data.
2 Request. Axios, carrying the Precognition header; files are left out unless form.validateFiles() is called.
3 Middleware. HandlePrecognitiveRequests on the route; the others run too, so guard side effects with isPrecognitive().
4 Form request. The same rules as the real submit; $this->isPrecognitive() can relax one, such as uncompromised().
5 Stop. The controller never runs. The response is the validation result for the fields that were asked about.
6 Form state. form.errors, valid(), invalid(), validating, hasErrors; a field shows a verdict only once it has changed.
Hidden joinery
The route's other middleware and controller dependencies still resolve, so a counter or a log line runs unless guarded with isPrecognitive(). By default files are not sent on a validation pass, so a large upload goes once. In users.*.email each star matches one segment. forgetError() clears one field's error.
Every line checked against the 13.x docs, framework source and npm on 2026-10-08.
TITLE
Precognition · one field, early
SOURCES
laravel.com/docs/13.x/precognition · github.com/laravel/framework/blob/13.x/src/Illuminate/Foundation/Http/Middleware/HandlePrecognitiveRequests.php · github.com/laravel/framework/blob/13.x/src/Illuminate/Http/Concerns/CanBePrecognitive.php · github.com/laravel/framework/blob/13.x/src/Illuminate/Foundation/Precognition.php · registry.npmjs.org/laravel-precognition · livewire.laravel.com/docs/4.x/validation
STATUS
Verified · 2026-10-08
SHEET
II.33 of 48
REV
A · 2026-10-08
DRAWN
BS
FINISH
All faces, including the back