fungku/spamguard
最新稳定版本:v0.2.0
Composer 安装命令:
composer require fungku/spamguard
包简介
Guarding form requests from spam bots.
关键字:
README 文档
README
Guarding form requests against bots.
Install
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,
Config (optional)
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"
Usage
To use the spamguard, there are two things you need to do.
1. Add the SpamGuard form elements in your form
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>
2. Add the SpamGuard middleware to your route or controller
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']);
Options
Currently there are four spam middleware registered:
spam_honeypotspam_timerspam_recaptchaspamguard: A catch-all of all the available SpamGuard middleware listed above.
Notes
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.
统计信息
- 总下载量: 128
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 14
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2015-07-05