Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/eusonlito/captcha

A new simple and easy-to-implement captcha package.
https://github.com/eusonlito/captcha

captcha php

Last synced: about 1 month ago
JSON representation

A new simple and easy-to-implement captcha package.

Awesome Lists containing this project

README

        

# Easy Captcha :)

[![Build Status](https://travis-ci.org/eusonlito/captcha.svg?branch=master)](https://travis-ci.org/eusonlito/captcha)
[![Latest Stable Version](https://poser.pugx.org/eusonlito/captcha/v/stable.png)](https://packagist.org/packages/eusonlito/captcha)
[![Total Downloads](https://poser.pugx.org/eusonlito/captcha/downloads.png)](https://packagist.org/packages/eusonlito/captcha)
[![License](https://poser.pugx.org/eusonlito/captcha/license.png)](https://packagist.org/packages/eusonlito/captcha)

A new simple and easy-to-implement captcha package.

## Installation with Composer

```json
{
"require": {
"eusonlito/captcha": "1.0.*"
}
}
```

## Demos

![Default Captcha](https://eusonlito.github.io/captcha/assets/images/multiple-fonts.png)
![Only one font](https://eusonlito.github.io/captcha/assets/images/one-font.png)
![Large Captcha](https://eusonlito.github.io/captcha/assets/images/large.png)
![Short Captcha](https://eusonlito.github.io/captcha/assets/images/short.png)
![With Background](https://eusonlito.github.io/captcha/assets/images/background.png)
![Custom Letters](https://eusonlito.github.io/captcha/assets/images/letters.png)
![With Noise](https://eusonlito.github.io/captcha/assets/images/noise.png)
![Only Noise Points](https://eusonlito.github.io/captcha/assets/images/noise-points.png)
![Only Noise Lines](https://eusonlito.github.io/captcha/assets/images/noise-lines.png)

## Usage

### Template

```php



... or ...

= Captcha::img($LETTERS_COUNT, $WIDTH, $HEIGHT); ?>

... or ...

= Captcha::img($LETTERS_COUNT, $WIDTH, $HEIGHT, array('class' => 'img-responsive')); ?>

... or ...

= Captcha::img($LETTERS_COUNT, $WIDTH, $HEIGHT); ?>
= Captcha::input(array('class' => 'form-control')); ?>

... or ...

= Captcha::img(array($LETTERS_MIN, $LETTERS_MAX), $WIDTH, $HEIGHT); ?>
= Captcha::input(array('class' => 'form-control')); ?>


```

If you are using an environment without sessions, you must add `Captcha::sessionStart()` before any html output (Controller).

### Checking

```php
[
...

'Captcha' => 'Eusonlito\Captcha\Captcha',

...
]
];
```

Now you will have a `Captcha` class available on your controllers and views.

## Print Options

```php
'img-responsive')); # Print img tag with class attribute

# Simple input tag print
Captcha::input(); # Print input tag

# Input tag with parameters
Captcha::input(array('class' => 'form-control')); # Print input tag with class attribute
```

## Custom Setup

All custom settings will be defined before `img`, `source` or `check` methods calls.

```php