2017 © Pedro Peláez
 

library captcha

Awesome Captcha for Laravel

image

thytanium/captcha

Awesome Captcha for Laravel

  • Saturday, March 28, 2015
  • by thytanium
  • Repository
  • 3 Watchers
  • 3 Stars
  • 422 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 6 Versions
  • 2 % Grown

The README.md

Captcha for Laravel

Captcha, (*1)

Install

Edit your composer.json file, (*2)

Laravel 4

"require": {
  ...
  "thytanium/captcha": "1.*"
}

Laravel 5

"require": {
  ...
  "thytanium/captcha": "2.*"
}

Run composer update to install the package. Then add the following to app.php, (*3)

'providers' => array(
  ...
  'Thytanium\Captcha\CaptchaServiceProvider',
);
'aliases' => array(
  'Captcha' => 'Thytanium\Captcha\Facades\Captcha',
);

Then, you have to publish the configuration file., (*4)

php artisan vendor:publish --provider="Thytanium\Captcha\CaptchaServiceProvider"

Use

To use it just put this HTML code in your form next to a text input., (*5)

<img src="{{URL::to('captcha')}}">

Validate

To validate the entered text into the input, put this in your validation rules:, (*6)

$rules = [
  'text_input' => 'required|captcha'
];

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

Options

You can edit config/captcha.php configuration file to change behavior of captcha., (*7)

String length

By default, string length is 6 characters. You can change it to whatever length you want. Remember, you might have to change width also, is not auto-calculated., (*8)

'length' => 6

Width and height

By defaut, width and height are 200px x 50px. You can change it to any other size., (*9)

'width' => 200,
'height' => 50

Case sensitive

By default case verification is enabled. Change it to false to disable it., (*10)

'case_sensitive' => true

Letters case

If you want the captcha to show only upper letters, lower letters or mixed., (*11)

'case' => 'upper' //For upper case letters only
'case' => 'lower' //For lower case letters only
'case' => 'mixed' //For both upper and lower case

Show letters/numbers

If you want a captcha with letters only:, (*12)

'letters' => true,
'numbers' => false

If you want a captcha with numbers only:, (*13)

'letters' => false,
'numbers' => true

If you want a captcha with both letters and numbers:, (*14)

'letters' => true,
'numbers' => true

Character angle

By default, character angle is 15. This will generate an captcha with characters angle between 0 and 15 degrees. Change it to whatever you want. If you want the characters in "straight" way, just put this value to 0 (zero)., (*15)

'angle' => 15

Separation

This is separation between characters. Default is 30. The higher the more separated., (*16)

'separation' => 30,

Background grid

By default, background shows 20 vertical lines and 5 horizontal lines (one every 10 pixels). You can show as many lines as you want., (*17)

'h_lines' => 5, //Horizontal lines
'v_lines' => 20 //Vertical lines

Colors

Colors must be provided in RGB notation [rrr,ggg,bbb]., (*18)

Background color

By default is 250,250,250 (almost white), (*19)

'background' => [250, 250, 250]
Line color

By default is 220,220,220 (very light gray), (*20)

'line_color' => [220, 220, 220]
Font colors

This is an array of choices. You can add as many colors as you want and the characters will rendered is this colors randomly., (*21)

'colors' => [
    [0, 83, 160],
    [33, 125, 211],
    [30, 134, 232],
    [11, 72, 130],
    [13, 119, 219],
    [0, 102, 150],
    [51, 113, 142],
],

Font

This package works with TrueType (.ttf) fonts., (*22)

Four font choices are already provided: Prototype (default), Impact, BrianJames and Spinwerad. All of them thanks to 1001freefonts., (*23)

Prototype
'font' => 'Prototype' //Ignore .ttf extension

Prototype, (*24)

Impact
'font' => 'Impact' //Ignore .ttf extension

Impact, (*25)

BrianJames
'font' => 'BrianJames' //Ignore .ttf extension

BrianJames, (*26)

Spinwerad
'font' => 'Spinwerad' //Ignore .ttf extension

Spinwerad, (*27)

Font size

By default, font size is 30px. Change it to whatever you want., (*28)

'size' => 30

Image quality

By default, and I recommend to keep it that way, image quality is 100., (*29)

'quality' => 100,

The Versions

28/03 2015

dev-master

9999999-dev

Awesome Captcha for Laravel

  Sources   Download

MIT

The Requires

 

by Alejandro González

27/03 2015

dev-l4

dev-l4

Awesome Captcha for Laravel

  Sources   Download

MIT

The Requires

 

by Alejandro González

27/03 2015

v1.0.2

1.0.2.0

Awesome Captcha for Laravel

  Sources   Download

MIT

The Requires

 

by Alejandro González

13/03 2015

v1.0.1

1.0.1.0

Awesome Captcha for Laravel

  Sources   Download

MIT

The Requires

 

by Alejandro González

13/03 2015

v2.0

2.0.0.0

Awesome Captcha for Laravel

  Sources   Download

MIT

The Requires

 

by Alejandro González

13/03 2015

v1.0

1.0.0.0

Captcha for laravel

  Sources   Download

MIT

The Requires

 

by Alejandro González