devfactory/captcha

There is no license information available for the latest version (dev-master) of this package.

A multiple instance, captcha for laravel 4

dev-master 2014-09-18 15:07 UTC

This package is not auto-updated.

Last update: 2024-11-05 08:14:57 UTC


README

A simple captcha for laravel 4

Preview

Preview

How to setup

update composer.json file:

{
    "require": {
        "laravel/framework": "4.1.*",
        "devfactory/captcha": "dev-master"
    }
}

and run composer update from terminal to download files.

update app.php file in app/config directory:

'providers' => array(
  devfactory\Captcha\CaptchaServiceProvider'
),
alias => array(
      'Captcha' => 'devfactory\Captcha\Facades\Captcha'
),

How to use

in your HTML form add following code:

{{ Captcha::img('captcha1') }}
{{ Form::text('input_captcha') }}

and for validate user entered data just add captcha to array validation rules.

$rules = array(
  'input_captcha' => 'required|captcha:captcha1'
);

$validator = Validator::make(Input::all(), $rules);

if($validator -> fails()) {
  return Redirect::back() -> withErrors($validator);
}