PHP code example of hirenkeraliya / lara-captcha

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

    

hirenkeraliya / lara-captcha example snippets


    <form method="POST" action="/submit-form">
      @csrf
      @captcha

      <input type="text" name="name" placeholder="Name"><br>
      <input type="email" name="email" placeholder="Email"><br>
      <button type="submit">Submit</button>
    </form>
  

composer 

php artisan vendor:publish --tag=lara-captcha-config

  use Hirenkeraliya\LaraCaptcha\app\Http\Middleware\VerifyCaptcha;

  Route::post('contact-us', [ContactUsController::class, 'index'])->name('front.contact_us')->middleware(VerifyCaptcha::class);
  

  use Hirenkeraliya\LaraCaptcha\app\Http\Middleware\VerifyCaptcha;

  Route::group(['middleware' => VerifyCaptcha::class], function () {
    Route::post('contact-us', [ContactUsController::class, 'index'])->name('front.contact_us');
  });

  Route::middleware([VerifyCaptcha::class])->group(function () {
    Route::post('contact-us', [ContactUsController::class, 'index'])->name('front.contact_us');
  });