1. Go to this page and download the library: Download leuchtdiode/mezzio-fence 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/ */
leuchtdiode / mezzio-fence example snippets
use Try2catch\Fence\Fence;
#[Fence(limit: 5, perSeconds: 3600)]
class Start extends BaseJsonAction
{
}
use Try2catch\Fence\ConfigProvider as FenceConfigProvider;
$aggregator = new ConfigAggregator([
// ...
FenceConfigProvider::class,
]);
#[Fence(limit: 5)] // five a minute, if the default window is a minute
#[Fence(limit: 5, perSeconds: 3600)] // five an hour
#[Fence(enabled: false)] // never counted