PHP code example of martian / laracaptcha

1. Go to this page and download the library: Download martian/laracaptcha 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/ */

    

martian / laracaptcha example snippets


Martian\LaraCaptcha\Providers\LaraCaptchaServiceProvider::class,

    'default' => 'recaptcha',
    

    'drivers' => [
        'recaptcha' => [
            ...
            'version' => 'v2',
            ...
        ],
    ],
    

    'default' => 'recaptcha',
    

    'drivers' => [
        'recaptcha' => [
            ...
            'version' => 'v3',
            ...
        ],
    ],
    

    'default' => 'hcaptcha',
    

{!! LaraCaptcha::script() !!}

{!! LaraCaptcha::script('yourCallbackFunction', 'explicit', 'en') !!}

{!! LaraCaptcha::display() !!}

{!! LaraCaptcha::display(['data-theme' => 'dark']) !!}

{!! LaraCaptcha::displayInvisibleButton('formIdentifier', 'Submit Button',['data-size' => 'invisible']) !!}

'g-recaptcha-response' => 'recaptcha',

$validator = Validator::make($request->all(), [
    'g-recaptcha-response' => 'recaptcha',
]);

'g-recaptcha-response.recaptcha' => 'Captcha verification failed.',

'error_message' => 'Captcha verification failed.',

{!! LaraCaptcha::script() !!}

{!! LaraCaptcha::script('yourCallbackFunction', 'explicit', 'en') !!}

{!! LaraCaptcha::display() !!}

{!! LaraCaptcha::display(['action' => 'homepage', 'custom_validation' => 'yourCustomFunction', 'recaptcha_input_identifier' => 'yourReCaptchaInputId']) !!}

{!! LaraCaptcha::script() !!}

{!! LaraCaptcha::script('yourCallbackFunction', 'onload' 'en', 'on') !!}

{!! LaraCaptcha::display() !!}

{!! LaraCaptcha::display(['data-theme' => 'dark']) !!}

{!! LaraCaptcha::displayInvisibleButton('formIdentifier', 'Submit Button',['data-size' => 'invisible']) !!}

'h-captcha-response' => 'hcaptcha',

$validator = Validator::make($request->all(), [
    'h-captcha-response' => 'hcaptcha',
]);

'h-captcha-response.hcaptcha' => 'Captcha verification failed.',

'error_message' => 'Captcha verification failed.',
bash
php artisan vendor:publish --provider="Martian\LaraCaptcha\Providers\LaraCaptchaServiceProvider"