fussraider/laravel-yandex-captcha

Yandex captcha integration for Laravel

Installs: 43

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 3

pkg:composer/fussraider/laravel-yandex-captcha

2.2.0 2025-09-24 21:26 UTC

This package is auto-updated.

Last update: 2025-10-24 21:39:20 UTC


README

Laravel Yandex Captcha

A small package that will allow you to use Yandex SmartCaptcha in your Laravel app

Features

  • Easy to use Yandex SmartCaptcha Blade component
  • Easy to use Yandex SmartCaptcha validation

Installation

Install fussraider/laravel-yandex-captcha from composer

  composer require fussraider/laravel-yandex-captcha

Usage

  1. Add to your .env YANDEX_CAPTCHA_CLIENT_KEY YANDEX_CAPTCHA_SERVER_KEY

  2. Publish config

    php artisan vendor:publish --tag=yandex-captcha-config
  3. Add the Blade component to the form that needs a captcha

    <form action="{{route('login')}}" method="post">
        @csrf
        <input type="text" name="email">
        <input type="password" name="password">
        <x-yandex-captcha></x-yandex-captcha>
        <button type="submit">Send</button>
    </form>
  4. Add YandexCaptcha validation rule

    <?php  
      
    namespace App\Http\Requests;  
      
    use Fussraider\YandexCaptcha\Rules\YandexCaptcha;use Illuminate\Foundation\Http\FormRequest;  
      
    class LoginRequest extends FormRequest  
    {  
      public function rules(): array  
      {  
        return [  
          'email' => ['required', 'email'],  
          'password' => ['required', 'string', 'min:8'],  
          'smart-token' => ['required', new YandexCaptcha]  
        ];  
      }
      
      public function authorize(): bool  
      {  
        return true;  
      }  
    }

If you want to customize blade component you can publish it with

php artisan vendor:publish --tag=yandex-captcha-view