| Package Data | |
|---|---|
| Maintainer Username: | m-jch |
| Maintainer Contact: | mohsen.sh12@hotmail.com (mohsen shafiei) |
| Package Create Date: | 2014-04-14 |
| Package Last Update: | 2015-08-20 |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-12-10 03:16:26 |
| Package Statistics | |
|---|---|
| Total Downloads: | 5,207 |
| Monthly Downloads: | 1 |
| Daily Downloads: | 0 |
| Total Stars: | 12 |
| Total Watchers: | 2 |
| Total Forks: | 2 |
| Total Open Issues: | 0 |
#Captcha
A simple captcha for laravel 4

##How to setup
update composer.json file:
{
"require": {
"laravel/framework": "4.1.*",
"mohsen/captcha": "dev-master"
}
}
and run composer update from terminal to download files.
update app.php file in app/config directory:
'providers' => array(
...
'Mohsen\Captcha\CaptchaServiceProvider',
...
),
...
'aliases' => array(
...
'Captcha' => 'Mohsen\Captcha\Captcha',
...
),
##How to use
in your HTML form add following code:
<img src="{{Captcha::getImage()}}">
<input type="text" name="user-captcha">
and for validate user entered data just add captcha to array validation rules.
$rules = array(
'user-captcha' => 'required|captcha'
);
$validator = Validator::make(Input::all(), $rules);
if($validator -> fails()) {
return Redirect::back() -> withErrors($validator);
}
All parameters are optional.
<img src="{{Captcha::getImage($count, $width, $height, $backgroundColor, $quality)}}">
$count: Number of characters [default=7]
$width: Width of image [default=160]
$height: Height of image [default=70]
$backgroundColor: Background color of image [default='efefef']
$quality: Quality of image [default=50]