tsoftware / captcha
A simple and fast captcha generator
v1.0
2015-12-23 20:07 UTC
Requires
- php: >=5.5.9
- illuminate/session: 5.1.*
- illuminate/support: 5.1.*
This package is not auto-updated.
Last update: 2024-12-25 19:48:14 UTC
README
##Introduction Tsoftware\Captcha is a captcha generator in Laravel 5!
##Useage First:
composer require tsoftware/captcha
in app/config.php add
'providers' => [ Tsoftware\Captcha\CaptchaProvider::class, ] 'aliases' => [ 'Captcha' => Tsoftware\Captcha\CaptchaFacade::class, ]
for emaple in app/Http/Controllers/Auth/AuthController.php file
use Captcha; public function getCaptcha() { return Captcha::output('_captcha', 100, 40, 4); } protected function validator(array $data) { $validator = Validator::make($data, [ 'name' => 'required|min:5|max:20', 'email' => 'required|email|max:255|unique:users', 'password' => 'required|confirmed|min:5', 'captcha' => 'required', ]); $validator->after(function($validator) use ($data){ if (!Captcha::check($data['captcha'])) { $validator->errors()->add('captcha', 'Wrong captcha code!'); } }); return $validator; }
##FeedBack
- Mail(admin@yantao.info)
- QQ: 1065317290
- Blog: Yantao.Info
- GitHub: tsoftware-org/captcha