PHP code example of yhbyun / laravel-securimage

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

    

yhbyun / laravel-securimage example snippets


return [
    'length' => env('SECURIMAGE_LENGTH', 6),
    'width'  => env('SECURIMAGE_WIDTH', 215),
    'height'  => env('SECURIMAGE_HEIGHT', 80),
    'perturbation' => env('SECURIMAGE_PERTURBATION', .85),
    'case_sensitive' => env('SECURIMAGE_CASE_SENSITIVE', false),
    'num_lines' => env('SECURIMAGE_NUM_LINES', 0),
    'charset' => env('SECURIMAGE_CHARSET', 'ABCDEFGHKLMNPRSTUVWYZabcdefghklmnprstuvwyz23456789'),
    'signature' => env('SECURIMAGE_SIGNATURE', 'ecplaza'),
    'show_text_input' => env('SECURIMAGE_SHOW_TEXT_INPUT', false),
];

$ php artisan vendor:publish --provider="Yhbyun\Securimage\SecurimageServiceProvider"

Route::any('captcha-test', function()
{
    if (Request::getMethod() == 'POST')
    {
        $rules = ['captcha' => 'ho '<p style="color: #ff0000;">Incorrect!</p>';
        }
        else
        {
            echo '<p style="color: #00ff30;">Matched :)</p>';
        }
    }

    $form = '<form method="post" action="captcha-test">';
    $form .= '<input type="hidden" name="_token" value="' . csrf_token() . '">';
    $form .= '<p>' . captcha_img() . '</p>';
    $form .= '<p><button type="submit" name="check">Check</button></p>';
    $form .= '</form>';
    return $form;
});