Lock
The real risk when evolving an API is a forgotten since(): a new field leaking into revisions already published.
Rather than requiring a bound on every field, the library freezes the published revisions.
Lock the published revisions
php artisan revision:lock
INFO Locked genesis, winter-25.
It locks every revision but the head that has no lock yet. Each revision is one file, revisions.lock/<value>.json:
the structure of the JSON Schema of every class and declaration kind, without documentation, and the revision before
it in order().
{
"previous": "genesis",
"classes": {
"App\\Http\\Requests\\StoreOrderRequest": {
"request-body": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"name": { "type": "string" },
"state": {
"enum": ["pending", "paid", "cancelled"],
"type": "string"
},
"title": { "maxLength": 255, "type": "string" },
"total": { "type": "string" }
},
"required": ["title", "total", "name"],
"type": "object"
}
}
}
}
Commit the directory, and never edit it by hand.
When the lock fails
revision:check compares every locked revision with the declarations:
| Code | Class | Field | Revision | Message |
|---|---|---|---|---|
lock-mismatch | OrderResource | name | winter-25 | 'name' (response) is new in the locked revision winter-25: declare its since(), or lock winter-25 again. |
lock-mismatch: a locked revision changed. Almost always a forgottensince(N): fix the declaration.lock-order-changed: a locked revision moved inorder().
Descriptions, examples and deprecated() never break a lock.
Re-locking a published revision accepts its change for every client already on it: a deliberate decision, never a way to silence the check.
php artisan revision:lock --revision=winter-25
The head stays free
The head is not locked by revision:lock: you change it until you publish the next revision. Lock it when you
add the next revision, before changing any declaration.
--revision=<head> locks it explicitly if you need to.