Coder Social home page Coder Social logo

laravel-securimage's Introduction

Laravel 5 Securimage helper

Build Status

A simple laravel 5 wrapper package for Securimage.

preview

Installation

Add the package to your composer.json by running:

composer require yhbyun/laravel-securimage

When it's installed, add it to the providers list in config/app.php

Yhbyun\Securimage\SecurimageServiceProvider::class,

Publish assets to your public folder

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

Configuration

config/securimage.php

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),
];

Example Usage

app/Http/routes.php

Route::any('captcha-test', function()
{
    if (Request::getMethod() == 'POST')
    {
        $rules = ['captcha' => 'required|captcha'];
        $validator = Validator::make(Input::all(), $rules);
        if ($validator->fails())
        {
            echo '<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;
});

Testing

$ phpunit --stderr

laravel-securimage's People

Contributors

yhbyun avatar classicvalues avatar zzmmzz777 avatar mend-bolt-for-github[bot] avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.