dev-master
9999999-dev https://github.com/sayakb/captchaCaptcha Package for Laravel 4, Fork of mewebstudio/captcha
MIT
The Requires
- php >=5.3.0
- illuminate/support >=4.0.0
laravel laravel 4 security captcha l4 captcha image mecaptcha
Captcha Package for Laravel 4, Fork of mewebstudio/captcha
A simple Laravel 4 service provider for including the Captcha for Laravel 4., (*1)
, (*2)
The Captcha Service Provider can be installed via Composer by requiring the
sayakb/captcha
package and setting the minimum-stability
to dev
(required for Laravel 4) in your
project's composer.json
., (*3)
{ "require": { "laravel/framework": "4.1.*", "sayakb/captcha": "dev-master" }, "minimum-stability": "dev" }
Update your packages with composer update
or install with composer install
., (*4)
To use the Captcha Service Provider, you must register the provider when bootstrapping your Laravel application. There are essentially two ways to do this., (*5)
Find the providers
key in app/config/app.php
and register the Captcha Service Provider., (*6)
'providers' => array( // ... 'Sayakb\Captcha\CaptchaServiceProvider', )
Find the aliases
key in app/config/app.php
., (*7)
'aliases' => array( // ... 'Captcha' => 'Sayakb\Captcha\Facades\Captcha', )
To use your own settings, publish config., (*8)
$ php artisan config:publish sayakb/captcha
, (*9)
// [your site path]/app/routes.php Route::any('/captcha-test', function() { if (Request::getMethod() == 'POST') { $rules = array('captcha' => array('required', 'captcha')); $validator = Validator::make(Input::all(), $rules); if ($validator->fails()) { echo '<p style="color: #ff0000;">Incorrect!</p>'; } else { echo '<p style="color: #00ff30;">Matched :)</p>'; } } $content = Form::open(array(URL::to(Request::segment(1)))); $content .= '<p>' . HTML::image(Captcha::img(), 'Captcha image') . '</p>'; $content .= '<p>' . Form::text('captcha') . '</p>'; $content .= '<p>' . Form::submit('Check') . '</p>'; $content .= '<p>' . Form::close() . '</p>'; return $content; });
^_^, (*10)
Captcha Package for Laravel 4, Fork of mewebstudio/captcha
MIT
laravel laravel 4 security captcha l4 captcha image mecaptcha