PHP code example of irfanokr / laravel-secure-bridge

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

    

irfanokr / laravel-secure-bridge example snippets


// Protected — requests to these must be signed:
Route::middleware('secure-bridge')->group(function () {
    Route::post('/profile', [ProfileController::class, 'update']);
    Route::get('/orders', [OrderController::class, 'list']);
});

// Not protected — works normally, no signing needed:
Route::get('/', [HomeController::class, 'index']);

// config/secure-bridge.php
'handshake' => [
    'enabled'    => true,
    'route'      => 'secure-bridge/handshake',
    'middleware' => ['auth:sanctum'],   // 👈 YOUR login guard (auth:api / jwt.auth / passport …)
],
'except' => ['api/login', 'api/register', 'secure-bridge/handshake'],

Route::middleware('secure-bridge')->group(function () {
    // your protected API routes go here
});
bash
php artisan vendor:publish --tag=secure-bridge-config