Evolving the API

Retiring a revision

Remove the oldest revision once no client uses it, and delete the declarations it alone needed.

When the oldest revision has no client left, retire it. The history declared for it becomes dead code, and the library lists it for you.

List the dead declarations

Terminal
php artisan revision:prune
Retiring Genesis (the oldest revision) makes 5 declarations dead:
- App\Http\Resources\OrderResource response 'total': was(Genesis),
  delete the was() (/srv/app/app/Http/Resources/OrderResource.php:38)
…

Each line names the class, the declaration kind, the field, the dead declaration, what to do and where (lines wrapped here). On the quick-start scenario:

ClassKindFieldDeclarationLocation
StoreOrderRequestrequest-bodystatuswas(Genesis)StoreOrderRequest.php:27
StoreOrderRequestrequest-bodytotalwas(Genesis)StoreOrderRequest.php:35
OrderResourceresponsestatuswas(Genesis)OrderResource.php:30
OrderResourceresponsetotalwas(Genesis)OrderResource.php:38
OrderResourceresponselines.*.quantitywas(Genesis)OrderResource.php:51

It lists each until(P) (delete the field), was(P) (delete that was()) and since(P) (delete the bound, already a no-op). The command is informative and always succeeds.

It does not read class lifetimes: delete a class whose lifetime ends at the retired revision yourself, and the since() of a lifetime that starts there.

Delete the case

Remove the case from the enum and from order(). PHPStan reports any reference left.

Re-lock the new oldest revision

Delete the retired revision's lock file, then lock the new oldest revision again: its recorded predecessor is gone.

Terminal
rm revisions.lock/genesis.json
php artisan revision:lock --revision=winter-25

Check

Terminal
php artisan revision:check

A queued job captured in the retired revision and run afterwards fails with UnknownRevisionException: drain the queues first.

JSON:API users: Checking & retiring a revision.