PHP code example of therealmkadmi / laravel-citadel
1. Go to this page and download the library: Download therealmkadmi/laravel-citadel 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/ */
therealmkadmi / laravel-citadel example snippets
return [
/*
|--------------------------------------------------------------------------
| Rate Limiting
|--------------------------------------------------------------------------
|
| Define the maximum number of requests per minute and minimum allowed
| time interval between orders. The firewall uses a sliding window implemented
| with Redis sorted sets to track request frequency.
|
*/
'rate_limit' => [
'window' => 60000, // in milliseconds (60 seconds)
'max_requests' => 5,
'min_interval' => 5000, // in milliseconds (5 seconds)
'excess_weight'=> 10, // points per extra request
'burst_weight' => 20, // additional points if requests are too bursty
],
/*
|--------------------------------------------------------------------------
| Payload Analysis
|--------------------------------------------------------------------------
|
| Define // in seconds (1 hour)
],
/*
|--------------------------------------------------------------------------
| Device Fingerprint
|--------------------------------------------------------------------------
|
| Define the weights for device types. Since the typical usage involves
| mobile devices (via QR codes), desktop or unusual User-Agents increase
| the suspect score.
|
*/
'device' => [
'desktop_weight' => 15,
'automation_weight' => 30,
],
/*
|--------------------------------------------------------------------------
| Referrer Validation
|--------------------------------------------------------------------------
|
| Configure valid referers. Requests originating from an unexpected domain
| or with no referer add to the suspect score.
|
*/
'referrer' => [
'expected_domain' => env('APP_URL'),
'missing_weight' => 5,
'invalid_domain_weight' => 15,
],
/*
|--------------------------------------------------------------------------
| Overall Threshold
|--------------------------------------------------------------------------
|
| The cumulative suspect score beyond which a request is considered malicious
| and is blocked.
|
*/
'threshold' => 30,
];