PHP code example of soapbox / signed-requests
1. Go to this page and download the library: Download soapbox/signed-requests 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/ */
soapbox / signed-requests example snippets
'providers' => [
...
SoapBox\SignedRequests\ServiceProvider::class
...
]
php artisan vendor:publish --provider 'SoapBox\SignedRequests\ServiceProvider'
'verify-signature' => \SoapBox\SignedRequests\Middlewares\Laravel\VerifySignature::class
Route::get('/fire', function () {
return "You'll only see this if the signature of the request is valid!";
})->middleware('verify-signature');
'default' => [
...
],
'custom' => [
'algorithm' => env('CUSTOM_SIGNED_REQUEST_ALGORITHM', 'sha256'),
'cache-prefix' => env('CUSTOM_SIGNED_REQUEST_CACHE_PREFIX', 'signed-requests'),
'headers' => [
'signature' => env('CUSTOM_SIGNED_REQUEST_SIGNATURE_HEADER', 'X-Signature'),
'algorithm' => env('CUSTOM_SIGNED_REQUEST_ALGORITHM_HEADER', 'X-Signature-Algorithm')
],
'key' => env('CUSTOM_SIGNED_REQUEST_KEY', 'key'),
'request-replay' => [
'allow' => env('CUSTOM_SIGNED_REQUEST_ALLOW_REPLAYS', false),
'tolerance' => env('CUSTOM_SIGNED_REQUEST_TOLERANCE_SECONDS', 30)
]
]
Route::get('/fire', function () {
return "You'll only see this if the signature of the request is valid!";
})->middleware('verify-signature:custom');