fruitcakestudio / laravel-recaptcha by barryvdh

Laravel integration for reCAPTCHA library
20,410
7
8
Package Data
Maintainer Username: barryvdh
Package Create Date: 2014-12-15
Package Last Update: 2014-12-19
Language: PHP
License: MIT
Last Refreshed: 2024-12-19 03:23:47
Package Statistics
Total Downloads: 20,410
Monthly Downloads: 27
Daily Downloads: 2
Total Stars: 7
Total Watchers: 8
Total Forks: 0
Total Open Issues: 0

Laravel integration for reCAPTCHA Library

This is a Laravel integration package for https://github.com/fruitcakestudio/php-recaptcha

Installation

Require this package with composer:

composer require fruitcakestudio/laravel-recaptcha

Laravel integration

You can use the Laravel ServiceProvider to make use of the Laravel Configuration and Request object.

Add the ServiceProvider to your list of ServiceProviders:

'FruitcakeStudio\ReCaptcha\Support\Laravel\ServiceProvider',

Publish the Configuration and edit the sitekey, secret and language.

php artisan config:publish fruitcakestudio/laravel-recaptcha

If you want to use the Facade, add that too.

'ReCaptcha' => 'FruitcakeStudio\ReCaptcha\Support\Laravel\Facade',

This will register the ReCaptcha instance, preconfigured with your configuration and the Request object.

// Using the IoC container
$captcha = App::make('recaptcha');
$captcha->getScript();

// Using the Facade
ReCaptcha::verifyRequest();

You can also add the ReCaptcha as a rule to the validator:

$validator = Validator::make(Input::all(), array(
    'g-recaptcha-response' => 'required|recaptcha'
));