3 ms·
Show HN: API versioning for Laravel – one codebase, support old versions forever
Stripe supports API versions going back to 2014 from a single codebase. Each version is handled by transformation layers, not duplicate controllers.
I built this package to bring that pattern to Laravel.
Each old version gets a transformer class with two methods:
- upgradeRequest() — converts old payload to current format before your controller runs
- downgradeResponse() — converts response back to old format before it leaves
The middleware chains them automatically across versions. Your controllers never change.
Supports 4 version detection strategies: URL prefix, header, query param, Accept header. Ships with deprecation headers (Sunset, Deprecation), artisan commands for changelog and audit.
composer require jayanta/laravel-api-versionist
- deleted 9mo ago[deleted]
- jay123anta 9mo agoAuthor here. Stripe's versioning model always impressed me — one codebase, versions going back years. I wanted that pattern in Laravel without the usual copy-paste-controllers approach. Happy to discuss the design decisions or any edge cases you can think of.