1. Go to this page and download the library: Download shetabit/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/ */
shetabit / captcha example snippets
# In your providers array.
'providers' => [
...
Shetabit\Captcha\Provider\CaptchaServiceProvider::class,
],
# In your aliases array.
'aliases' => [
...
'Payment' => Shetabit\Captcha\Facade\Captcha::class,
],
// Eg. if you want to use simple. (simple is the driver's name)
'default' => 'simple',
namespace App\Packages\CaptchaDriver;
use Illuminate\Support\ServiceProvider;
use Shetabit\Captcha\Abstracts\Driver;
class MyDriver extends Driver
{
protected $serviceProvider;
/**
* Driver settings.
*
* @var object
*/
protected $settings;
public function __construct(ServiceProvider $serviceProvider, $settings)
{
$this->serviceProvider = $serviceProvider;
$this->settings = (object) $settings;
}
/**
you must write your captcha generation
logic in the below method.
**/
public function generate()
{
...
// create captcha view and return it
return View::make('yourCustomDriverView');
}
/**
you must write your captcha verification
logic in the below method.
**/
public function verify($token = null)
{
...
$storedToken = ...
if (empty($this->settings->sensitive)) {
$storedToken = mb_strtolower($storedToken);
$token = mb_strtolower($token);
}
return $token == $storedToken;
}
}