-
-
Notifications
You must be signed in to change notification settings - Fork 4
Home
Jean-Marc Strauven edited this page Dec 23, 2025
·
2 revisions
Complete API versioning lifecycle management for Laravel
Laravel ApiRoute is a powerful package that provides complete API versioning lifecycle management for Laravel applications. It handles everything from version detection to deprecation headers, making it easy to manage multiple API versions in production.
- Multi-strategy versioning - URI path, Header, Query parameter, or Accept header
- Automatic deprecation headers - RFC 8594 (Deprecation) and RFC 7231 (Sunset) compliant
- Version lifecycle management - Active, Beta, Deprecated, Sunset states
- Intelligent fallback - Route fallback to previous versions when needed
- Artisan commands - Scaffold, monitor, and manage API versions
- Usage tracking - Optional analytics per API version
- Zero configuration start - Works out of the box with sensible defaults
| Getting Started | Core Features | Advanced |
|---|---|---|
| Installation | Version Declaration | Usage Tracking |
| Getting Started | Detection Strategies | Events |
| Configuration | HTTP Headers | Exceptions |
| Version Lifecycle | Advanced Usage | |
| Middleware | ||
| Artisan Commands |
- Installation - Install the package
- Getting Started - First API version in 5 minutes
- Examples - Common use cases
- Configuration - Customize behavior
- Detection Strategies - Choose your versioning strategy
- Version Lifecycle - Manage deprecation and sunset
- Artisan Commands - CLI tools
- HTTP Headers - RFC compliance
- Usage Tracking - Analytics and monitoring
- Events - Hook into version events
- Advanced Usage - Custom implementations
use Grazulex\ApiRoute\Facades\ApiRoute;
// Version 1 - Deprecated, sunset planned
ApiRoute::version('v1', function () {
Route::apiResource('users', UserController::class);
})
->deprecated('2025-06-01')
->sunset('2025-12-01');
// Version 2 - Current stable version
ApiRoute::version('v2', function () {
Route::apiResource('users', UserController::class);
})->current();
// Version 3 - Beta/Preview
ApiRoute::version('v3', function () {
Route::apiResource('users', UserController::class);
})->beta();- PHP: 8.3+
- Laravel: 12.x
This package implements the following RFC standards:
| RFC | Description | Header |
|---|---|---|
| RFC 8594 | The Sunset HTTP Header Field | Sunset |
| RFC 7231 | HTTP/1.1 Semantics | Deprecation |
| RFC 8288 | Web Linking | Link |
The MIT License (MIT). Please see License File for more information.
Created by Jean-Marc Strauven (@Grazulex)
Laravel ApiRoute - Complete API versioning lifecycle management for Laravel
Home | Getting Started | Examples | Configuration
Made with ❤️ for the Laravel community