Introduction
Laravel API Revisions lets each client of your API stay on the revision it was built against, Stripe-style, while your code keeps a single shape for each response and request: the latest one, called the head.
'status' => Schema::enum(OrderStatus::class)
->was(ApiRevision::Winter25, name: 'state'),
Clients up to winter-25 receive and send state, later clients status. Your controllers only see status.
How it works
You declare the head of each JsonResource and FormRequest with typed Schema descriptors. Only the fields that
changed carry their history: since(), until() and was(). From that one declaration the library derives:
| Direction | What happens |
|---|---|
| Down (responses) | The head value is read, then converted down to the shape of the client's revision. |
| Up (requests) | The input is validated in the client's revision, with the names it knows, then upgraded up to the head. |
| Describe (tooling) | Each revision gets a JSON Schema, a changelog entry, a consistency check and a lock. |
With JSON:API
Laravel JSON:API builds its revisions on this library: a JSON:API resource declares its
attributes, relationships and meta with the same since(), until() and was(). Its
Revisions section covers them. This documentation covers the core: plain
Laravel resources and form requests, the revision enum, resolution, tooling and extension points.
Compatibility
| Version | PHP | Laravel | Status |
|---|---|---|---|
| 1.x | ^8.3 | ^12.46 || ^13.0 | Active |
Next
Install the package, then follow the quick start.