Export and changelog
JSON Schema export
# every revision, class and kind: {revision: {class: {kind: schema}}}
php artisan revision:export
# one revision, one class
php artisan revision:export --revision=winter-25 \
--class="App\Http\Resources\OrderResource"
The export is a JSON Schema (draft 2020-12) per class, declaration kind (response, request-body,
request-query) and revision, read from the same shapes as the rendering and the validation. With one revision, one
class and one kind left, it prints a single schema:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "App\\Http\\Resources\\OrderResource",
"$comment": "response at winter-25: `paid` becomes `state`, …",
"type": "object",
"properties": {
"title": { "type": "string" },
"state": { "type": "string", "enum": ["pending", "paid", "cancelled"] },
"total": { "type": "string" },
"lines": {
"type": "array",
"items": {
"type": "object",
"properties": {
"sku": { "type": "string" },
"quantity": { "type": "integer" }
},
"required": ["sku", "quantity"]
}
},
"customer": { "$ref": "#/$defs/App.Http.Resources.CustomerResource" },
"name": { "type": "string" }
},
"required": ["title", "state", "total", "lines", "name"],
"$defs": {
"App.Http.Resources.CustomerResource": {
"type": "object",
"properties": {
"name": { "type": "string" },
"email": { "type": "string", "format": "email" }
},
"required": ["name", "email"]
}
}
}
The $comment carries the revision's #[Meta]: its description, publication and deprecation days. Nested
resources and components (Schema::object([...])->component('Address'), custom types) go to $defs.
Conditional fields are not required.
ark4ne/laravel-openapi-generatorLaravel OpenAPI Generator builds one OpenAPI document per revision from this export.
Changelog
# every revision, newest first
php artisan revision:changelog
# --from excluded, --to included
php artisan revision:changelog --from=genesis --to=winter-25
Each revision is headed by its #[Meta], then lists, per class and kind, the fields added, removed, renamed or
retyped. An excerpt of php artisan revision:changelog --from=winter-25:
# Changelog
## spring-26
`state` renamed `status`, totals in cents, `name` split, tags
### App\Http\Resources\OrderResource (response)
- Renamed `state` to `status`.
- Changed the type of `total`: `{"type":"string"}` → `{"type":"integer"}`.
- Added `first_name`.
- Added `last_name`.
- Added `tags`.
- Removed `name`.
Publish it to your clients, or read it back after a change to check that it says what you meant.
To read the export and the changelog from PHP (a documentation generator, for instance), see Without Laravel.