1. Go to this page and download the library: Download lyrasoft/contact 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/ */
'rate_limit' => [
// Default rate limit config
'_default' => [
'policy' => 'fixed_window',
'limit' => 10,
'interval' => '1day',
],
// You can add different rate limit for different type
'main' => [
'policy' => 'fixed_window',
'limit' => 10,
'interval' => '1day',
],
],
public function save(
AppContext $app,
ContactService $contactService,
// ...
): mixed {
// Set your form type
$type = 'inquiry';
// Check or throw
$contactService->rateLimitOrThrow($type, $app->getAppRequest()->getClientIP());
// Or throw yourself
$limit = $contactService->checkRateLimit($type, $app->getAppRequest()->getClientIP());
if (!$limit->isAccepted()) {
throw new \RuntimeException('Rate limit exceeded', 429);
}
// ...
shell
php windwalker pkg:install lyrasoft/contact -t lang
shell
php windwalker g controller Admin/FooContact
php windwalker g view Admin/FooContact
php windwalker g form Admin/FooContact/Form/EditForm
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.