PHP code example of italofantone / api-token-validator
1. Go to this page and download the library: Download italofantone/api-token-validator 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/ */
italofantone / api-token-validator example snippets
use Illuminate\Support\Facades\Route;
use Italofantone\ApiTokenValidator\Http\Middleware\EnsureApiTokenIsValid;
Route::get('protected-route', function () {
return response()->json([
'message' => 'You are authorized to access this route!',
]);
})
->middleware(EnsureApiTokenIsValid::class)
->name('protected-route');