PHPackages                             muneebstack/captcha-builder - 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. muneebstack/captcha-builder

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

muneebstack/captcha-builder
===========================

A library for generating and displaying CAPTCHA images with random text

1.0.1(9mo ago)00MITPHPPHP &gt;=7.0

Since Aug 20Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/MuneebStack/CaptchaBuilder)[ Packagist](https://packagist.org/packages/muneebstack/captcha-builder)[ RSS](/packages/muneebstack-captcha-builder/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

CaptchaBuilder
==============

[](#captchabuilder)

**CaptchaBuilder** is an open-source PHP library for generating CAPTCHA images using the GD extension.

### Features

[](#features)

- CAPTCHA image generation
- Configurable text length and font size
- Session-friendly CAPTCHA validation
- Simple API for refreshing CAPTCHA challenges
- Composer-based installation

Prerequisites
-------------

[](#prerequisites)

Before using CaptchaBuilder, please make sure that the GD extension for PHP is installed and enabled. To enable it, follow these steps:

1. Open your `php.ini` file.
2. Search for the following line:

    ```
    ;extension=gd

    ```
3. Remove the semicolon (;) from the beginning of the line to enable the GD extension:

    ```
    extension=gd

    ```
4. Save the `php.ini` file and restart your web server to apply the changes.

Installation
------------

[](#installation)

To install the CaptchaBuilder library in your project, use Composer:

```
composer require muneebstack/captcha-builder
```

Usage
-----

[](#usage)

1. Create an instance of `CaptchaBuilder\Captcha`:

    ```
    use CaptchaBuilder\Captcha;

    $captcha = new Captcha();
    ```

    The optional `length` parameter, passed as the first argument, and `fontSize`, passed as the second argument, can be specified. By default, the `length` of the captcha text is set to `6`, and `fontSize` to `20`.
2. To retrieve the CAPTCHA text, use the `getCaptchaText` method:

    ```
    $text = $captcha->getCaptchaText();
    ```
3. To retrieve the CAPTCHA image, use the `getCaptchaImage` method, which will return the image data:

    ```
    $imageData = $captcha->getCaptchaImage();
    ```
4. To refresh the CAPTCHA, use the `refreshCaptcha` method:

    ```
    $captcha->refreshCaptcha();
    ```

    After calling the `refreshCaptcha` method, you can get the new text and image:

    ```
    $newText = $captcha->getCaptchaText();
    $newImageData = $captcha->getCaptchaImage();
    ```

Example
-------

[](#example)

Here's an example code to store the CAPTCHA text in the session and display a CAPTCHA image:

```
    require 'vendor/autoload.php';

    use CaptchaBuilder\Captcha;

    $captcha = new Captcha();
    $text = $captcha->getCaptchaText();
    $imageData = $captcha->getCaptchaImage();

    session_start();
    $_SESSION['captcha_text'] = $text;

    echo "";
```

Here's an example code to verify the CAPTCHA:

```
    $userInput = $_POST['captcha_input'];
    $captchaText = isset($_SESSION['captcha_text']) ? $_SESSION['captcha_text'] : '';

    if ($userInput === $captchaText) {
        echo "CAPTCHA verification successful!";
    } else {
        echo "CAPTCHA verification failed. Please try again.";
    }
```

License
-------

[](#license)

CaptchaBuilder is released under the MIT License.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance67

Regular maintenance activity

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

271d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d8e8e8a33faa4e1659a511914eadb555147168ba57a7450f7ed40edd0effd87e?d=identicon)[MuneebStack](/maintainers/MuneebStack)

---

Top Contributors

[![MuneebStack](https://avatars.githubusercontent.com/u/133972442?v=4)](https://github.com/MuneebStack "MuneebStack (5 commits)")

---

Tags

captcha-toolgd-extensionphp

### Embed Badge

![Health badge](/badges/muneebstack-captcha-builder/health.svg)

```
[![Health](https://phpackages.com/badges/muneebstack-captcha-builder/health.svg)](https://phpackages.com/packages/muneebstack-captcha-builder)
```

###  Alternatives

[log1x/acf-composer

Create fields, blocks, option pages, and widgets using ACF Builder and Sage 10

493760.2k13](/packages/log1x-acf-composer)[markrogoyski/ipv4-subnet-calculator

Network calculator for subnet mask and other classless (CIDR) network information.

177813.7k6](/packages/markrogoyski-ipv4-subnet-calculator)[b13/menus

Easy and fast menus for TYPO3 Frontends

58534.7k1](/packages/b13-menus)[hfig/mapi

Pure PHP library for reading and manipulating Microsoft Outlook .msg messages (MAPI documents)

40420.9k2](/packages/hfig-mapi)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
