PHP code example of bencolmer / laravel-fit-validator

1. Go to this page and download the library: Download bencolmer/laravel-fit-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/ */

    

bencolmer / laravel-fit-validator example snippets


Route::middleware('fit')->group(function () {
    //
});

// in routes/api.php

Route::middleware('fit')->group(function () {
    Route::get('example', [ExampleController::class, 'index']);
});

// in app/Http/Controllers/ExampleController.php

use Illuminate\Http\Request;

class ExampleController extends Controller
{
    public function index(Request $request)
    {
        $fit = $request->input('fit');

        // ...
    }
}

// ...

'applications' => [
    // ...

    // details for your other application
    'otherApp' => [
        'appId' => (string) env('FIT_OTHER_APP_ID', ''),
        'jwksUrl' => (string) env('FIT_OTHER_JWKS_URL', ''),
    ]
],

// in routes/api.php

Route::middleware('fit')->group(function () {
    // validate FITs using the "default" application config
});

Route::middleware('fit:otherApp')->group(function () {
    // validate FITs using the "otherApp" application config
});
bash
php artisan vendor:publish --provider="BenColmer\LaravelFITValidator\Providers\ServiceProvider"