Package Data | |
---|---|
Maintainer Username: | ryanwinchester |
Maintainer Contact: | fungku@gmail.com (Ryan Winchester) |
Package Create Date: | 2015-07-04 |
Package Last Update: | 2016-06-01 |
Home Page: | |
Language: | PHP |
License: | Apache-2.0 |
Last Refreshed: | 2024-11-09 03:02:53 |
Package Statistics | |
---|---|
Total Downloads: | 126 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 13 |
Total Watchers: | 4 |
Total Forks: | 2 |
Total Open Issues: | 0 |
Guarding form requests against bots.
composer require fungku/spamguard
Add the service provider to config/app.php
in the providers
array:
Fungku\SpamGuard\Providers\SpamGuardServiceProvider::class,
Add the alias to config/app.php
in the aliases
array:
'SpamGuard' => Fungku\SpamGuard\Facades\SpamGuard::class,
If you'd like to change the default package config values, then publish the config and change the defaults...
php artisan vendor:publish --provider="Fungku\SpamGuard\Providers\SpamGuardConfigServiceProvider" --tag="config"
To use the spamguard, there are two things you need to do.
Somewhere inside your form, just use SpamGuard::html()
.
Using all spam guard elements:
<form action="/some-route/action">
{!! SpamGuard::html() !!}
<!-- other form elements -->
</form>
Specifying specific elements:
<form action="/some-route/action">
{!! SpamGuard::html(['spam_honeypot', 'spam_timer', 'spam_recaptcha']) !!}
<!-- other form elements -->
</form>
Specifying specific middlewares:
class MyController extends Controller
{
public function __construct()
{
$this->middleware('spam_honeypot');
$this->middleware('spam_timer');
$this->middleware('spam_recaptcha');
}
}
Using all spam middleware:
$this->middleware('spamguard');
Using the spam_timer
middleware in a controller normally and overriding the min_time
and max_time
for a specific action:
$this->middleware('spam_timer:10,300', ['only' => 'postComment']);
Currently there are four spam middleware registered:
spam_honeypot
spam_timer
spam_recaptcha
spamguard
: A catch-all of all the available SpamGuard middleware listed above.If you are selectively using elements and middleware, please note that the elements you use must match up with the middleware you assign to the routes.