- Laravel 12 with Sanctum authentication - API versioning with grazulex/laravel-apiroute - spatie/laravel-query-builder for filtering/sorting - spatie/laravel-data for DTOs - dedoc/scramble for auto API documentation - Pest PHP testing framework - Docker development environment - Standardized JSON API responses - Rate limiting and CORS configuration - Comprehensive README documentation
30 lines
1.0 KiB
PHP
30 lines
1.0 KiB
PHP
<?php
|
|
|
|
use App\Http\Controllers\Api\V1\AuthController;
|
|
use Grazulex\ApiRoute\Facades\ApiRoute;
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| API Routes
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| API routes are versioned using grazulex/laravel-apiroute.
|
|
| Supports URI path, header, query, and Accept header detection.
|
|
| See config/apiroute.php for configuration options.
|
|
|
|
|
*/
|
|
|
|
// Version 1 - Current stable version
|
|
ApiRoute::version('v1', function () {
|
|
// Public routes
|
|
Route::post('register', [AuthController::class, 'register'])->name('api.v1.register');
|
|
Route::post('login', [AuthController::class, 'login'])->name('api.v1.login');
|
|
|
|
// Protected routes
|
|
Route::middleware('auth:sanctum')->group(function () {
|
|
Route::post('logout', [AuthController::class, 'logout'])->name('api.v1.logout');
|
|
Route::get('me', [AuthController::class, 'me'])->name('api.v1.me');
|
|
});
|
|
})->current();
|