v1.0.0is out

Laravel API Revisions

Typed schemas for Laravel resources and form requests, evolved through dated API revisions, Stripe-style.

Why Laravel API Revisions

Every change to a response breaks a client built against the old one, and copying resources per version multiplies the code. Declare the latest shape once; each client keeps the revision it was built against.

A revision per client

Picked from a header, the path or the query, with Deprecation and Sunset headers from its #[Meta].

History on the field

Only the fields that changed carry their past: since(), until(), was(). No copied resource, no if per version.

Requests upgraded

Validated with the names the client knows, upgraded to the latest shape: controllers handle one input.

Checked and locked

revision:check and the lock fail the build on a forgotten since(), before a published revision changes.

One request, two revisions

The same controller and the same OrderResource, asked by a client on spring-26 and one on genesis.

The resource declares only the spring-26 shape. The quick start builds it, with the winter-25 revision in between.
GET
/orders/1
Api-Revision: spring-26
Response200 OK
{
  "data": {
    "title": "Lamp",
    "status": "paid",
    "total": 1250,
    "lines": [{ "sku": "L-1", "quantity": 2 }],
    "customer": { "name": "Ada Lovelace", "email": "ada@example.com" },
    "first_name": "Ada",
    "last_name": "Lovelace",
    "tags": ["gift"]
  }
}
GET
/orders/1
Api-Revision: genesis
Response200 OK
{
  "data": {
    "title": "Lamp",
    "paid": true,
    "total": 12.5,
    "lines": [{ "sku": "L-1", "qty": 2 }],
    "customer": { "name": "Ada Lovelace", "email": "ada@example.com" },
    "name": "Ada Lovelace"
  }
}

Compatibility

Laravel resources and form requests, with a pure-PHP core.

VersionPHP Laravel Status
1.x^8.3^12.46 || ^13.0Active

Start with Laravel API Revisions

Install it, follow the quick start, and see your first result in minutes.

Works with

Laravel JSON:API
JSON:API 1.1 resources for Laravel, with typed values, validated includes and fieldsets, and API revisions.
v3.0.0ark4ne/laravel-json-api
Laravel OpenAPI Generator
Generates OpenAPI 3.0, 3.1 and 3.2 documents from a Laravel application, its routes, form requests and resources.
v1.2.0ark4ne/laravel-openapi-generator