PHP code example of tsoftware / captcha

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

    

tsoftware / captcha example snippets

C
  use Captcha;

  public function getCaptcha()
  {
    return Captcha::output('_captcha', 100, 40, 4);
  }
  
  
  protected function validator(array $data)
  {
        $validator = Validator::make($data, [
            'name' => '!Captcha::check($data['captcha']))
			{
				$validator->errors()->add('captcha', 'Wrong captcha code!');
			}
	    });

	    return $validator;
  }