PHP code example of lukeraymonddowning / honey
1. Go to this page and download the library: Download lukeraymonddowning/honey 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/ */
lukeraymonddowning / honey example snippets
// routes/web.php
Route::post('/test', fn() => event(new RegisterInterest))
->middleware(['honey'])
->name('some.route');
// routes/web.php
Route::post('/test', fn() => event(new RegisterInterest))
->middleware(['honey', 'honey-recaptcha'])
->name('some.route');
$token = request()->honey_recaptcha_token;
$response = Honey::recaptcha()->check($token);
$token = request()->honey_recaptcha_token;
$score = Honey::recaptcha()->check($token)['score'];
$token = request()->honey_recaptcha_token;
$probablyABot = Honey::recaptcha()->check($token)->isSpam();
public function boot()
{
Honey::failUsing(function() {
abort(404, "Move along. Nothing to see here...");
});
}
Honey::beforeFailing(fn() => Log::alert("A bot is trying to access our site. Red alert!"));
Honey::recaptcha()->afterRequesting(fn($response) => Log::info("This user got a reCaptcha score of {$response['score']}"));
$noSpam = Honey::check(request()->all());
Honey::fail();
Honey::disable();
bash
php artisan honey:install
bash
php artisan migrate