PHP code example of mbpcoder / laravel-api-versioning
1. Go to this page and download the library: Download mbpcoder/laravel-api-versioning library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mbpcoder / laravel-api-versioning example snippets
php
// laravel route file
Route::prefix('v2.1')->group(function () {
Route::get('version', function () {
return 'API v2.1';
});
});
Route::prefix('v2')->group(function () {
Route::get('version', function () {
return 'API v2';
});
});
Route::prefix('v1')->group(function () {
Route::get('version', function () {
return 'API v1';
});
Route::get('hello-world', function () {
return 'Hello World!';
});
});
php
php artisan vendor:publish --provider="MbpCoder\ApiVersioning\ApiVersioningServiceProvider"