PHPackages                             cleup/captcha - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. cleup/captcha

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

cleup/captcha
=============

Basic captcha

v1.0.2(2y ago)014MITPHP

Since Jan 19Pushed 2y ago1 watchersCompare

[ Source](https://github.com/cleup/captcha)[ Packagist](https://packagist.org/packages/cleup/captcha)[ Docs](https://github.com/cleup/captcha)[ RSS](/packages/cleup-captcha/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)DependenciesVersions (4)Used By (0)

Cleup Captcha
=============

[](#cleup-captcha)

Basic captcha for project security

#### Installation

[](#installation)

With composer:

```
composer require cleup/captcha

```

#### Usage

[](#usage)

##### Create an image

[](#create-an-image)

Create a captcha image and place it in a controller file or on a separate page of your application:

```
use Cleup\Package\Captcha\Image;

# Instance of the class
$captcha = new Image([
    # Captcha Parameters
    'width' => 300,
    'height' => 60,
    /* You can set a range for these parameters using various methods (rand, random_int) */
    // 'length' => 5,
    // 'fontSize' => 24,
    // 'allowedCharacters' => '1234567890abcdefghijkmnpqrstuvwxyz',
    // 'width' => 140,
    // 'height' => 60,
    // 'maxLines' => 8,
    // 'minLines' => 4,
    // 'pointColor' => array(77, 77, 77),
    // 'textColor' => array(
    //     rand(0, 78),
    //     rand(0, 100),
    //     rand(0, 7)
    // )
]);

// Create a captcha image
$captcha->create();

/* The end of the file. */
```

##### Output data on html page

[](#output-data-on-html-page)

```
...

// Or
