PHP code example of vizuaalog / laravel-recaptcha

1. Go to this page and download the library: Download vizuaalog/laravel-recaptcha library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

vizuaalog / laravel-recaptcha example snippets




use Recaptcha;
...

if(Recaptcha::check($request)) {
    // Success
} else {
    // Fail
}

$errors = Recaptcha::getErrors();



namespace App\Controllers;

use App\Post;
use Recaptcha;
use App\Http\Controllers\Controller;

class PostController extends Controller {
    // ... Your other methods above this
    public function store(Request $request, $id)
    {
        // Check to see if the captcha was completed
        if(!Recaptcha::check($request)) {
            return 'Captcha error: ' . Recaptcha::getErrors()[0];
        }

        Post::create($request->except(['_token', 'g-recaptcha-response']));

        return 'Completed';
    }
    // ... Your other methods below this
}
config/app.php