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

ActiveLibrary

muhammetsafak/captcha
=====================

PHP Basic Captcha

00PHP

Since Apr 23Pushed 4y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Captcha
=======

[](#captcha)

It's simply an old-school captcha app.

[![php-basic-captcha](https://user-images.githubusercontent.com/9823597/160092903-c6ba0a20-0391-4c2b-8b9d-68f5b6da7603.jpg)](https://user-images.githubusercontent.com/9823597/160092903-c6ba0a20-0391-4c2b-8b9d-68f5b6da7603.jpg)

Requirements
------------

[](#requirements)

- PHP 5.6 or higher
- PHP GD Extension

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

[](#installation)

```
composer require muhammetsafak/captcha:dev-main

```

or download and include the file `src/Captcha.php`.

Usage
-----

[](#usage)

The file `src/image-captcha.php` simply generates and presents a captcha for you. You can edit this file for a custom configuration or create your own.

### Configuration

[](#configuration)

```
$configs = array(
    'width'         => 200, // Width of captcha image to be created
    'height'        => 70, // Height of captcha image to be created
    'length'        => 7, // The number of characters to be found in the captcha image.
    'font'          => __DIR__ . '/src/AHGBold.ttf', // Defines the font of the captcha characters.
    'size'          => 18 // Defines the size of captcha characters.
);

```

To create a captcha image; `image-captcha.php`

```
require_once __DIR__ . '/src/Captcha.php';
$config = array(
    'width'         => 180,
    'height'        => 50,
    'length'        => 6
);
$captcha = new \MuhammetSafak\Captcha\Captcha($config);
$captcha->create();
```

```

    Refresh

    function captcha_refresh()
    {
        img = document.getElementById("captcha");
        img.src = '../src/image-captcha.php';
    }

```

A simple validation example is as follows.

```
require_once __DIR__ . '/src/Captcha.php';
$captcha = new \MuhammetSafak\Captcha\Captcha();
if(isset($_POST)){
    if($captcha->verify($_POST['areYouBot'])){
        // Success
        // ...process
    }else{
        // Error
        echo 'Enter the characters in the picture correctly.';
    }
}
```

Licence
-------

[](#licence)

Copyright © 2022 [MIT License](./LICENSE)

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity26

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/4b6b34f3ac8938d8ee52ba3bd260680855dc5715c7b2929d9380de30d15a67dd?d=identicon)[muhammetsafak](/maintainers/muhammetsafak)

---

Top Contributors

[![muhammetsafak](https://avatars.githubusercontent.com/u/104234499?v=4)](https://github.com/muhammetsafak "muhammetsafak (2 commits)")

### Embed Badge

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

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

PHPackages © 2026

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