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

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

yokov/captcha
=============

Captcha generator

0.0.1(6y ago)3392[1 issues](https://github.com/yokov/captcha/issues)MITPHP

Since Nov 7Pushed 6y agoCompare

[ Source](https://github.com/yokov/captcha)[ Packagist](https://packagist.org/packages/yokov/captcha)[ RSS](/packages/yokov-captcha/feed)WikiDiscussions master Synced 2d ago

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

captcha
=======

[](#captcha)

##### 一个 PHP 验证码库

[](#一个-php-验证码库)

### 安装

[](#安装)

```
$ composer require yokov/captcha -vvv
```

### 使用

[](#使用)

```
$config = [
    // 验证码字符类型
    'charType'          => 'default',
    // 验证码长度
    'length'            => 4,
    // 是否是 gif 动态图
    'isGif'             => false,
    // 动图帧率
    'gifFps'            => 12,
    // 图片宽度
    'width'             => 150,
    // 图片高度
    'height'            => 40,
    // 字体文件路径
    'fontPath'          => '',
    // 字体大小
    'fontSize'          => 24,
];

$builder = new \Yokov\Captcha\CaptchaBuilder($config);

// 获取验证码字符串
$builder->getChar();

// 生成验证码图片
$builder->build();
```

### 部分设置

[](#部分设置)

- 验证码字符类型

    1. default: 大小写字母和数字混合
    2. only\_char: 只有大小写字母
    3. only\_number: 只有数字
- 字体文件

    - *注：可自定义字体文件，fontPath 配置相应的字体文件路径即可*
    - *库中内置 9 种字体(fontPath 设置 1-9 可分别指定相应的字体)*

    字体序号静态样式动图1[![font-1](demo/image/1.gif)](demo/image/1.gif)[![gif-font-1](demo/image/animation/1.gif)](demo/image/animation/1.gif)2[![font-2](demo/image/2.gif)](demo/image/2.gif)[![gif-font-2](demo/image/animation/2.gif)](demo/image/animation/2.gif)3[![font-3](demo/image/3.gif)](demo/image/3.gif)[![gif-font-3](demo/image/animation/3.gif)](demo/image/animation/3.gif)4[![font-4](demo/image/4.gif)](demo/image/4.gif)[![gif-font-4](demo/image/animation/4.gif)](demo/image/animation/4.gif)5[![font-5](demo/image/5.gif)](demo/image/5.gif)[![gif-font-5](demo/image/animation/5.gif)](demo/image/animation/5.gif)6[![font-6](demo/image/6.gif)](demo/image/6.gif)[![gif-font-6](demo/image/animation/6.gif)](demo/image/animation/6.gif)7[![font-7](demo/image/7.gif)](demo/image/7.gif)[![gif-font-7](demo/image/animation/7.gif)](demo/image/animation/7.gif)8[![font-8](demo/image/8.gif)](demo/image/8.gif)[![gif-font-8](demo/image/animation/8.gif)](demo/image/animation/8.gif)9[![font-9](demo/image/9.gif)](demo/image/9.gif)[![gif-font-9](demo/image/animation/9.gif)](demo/image/animation/9.gif)

### License

[](#license)

MIT

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

2380d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/88389cc16fc60e8bdb5f1b1264131ca3b231939ec660ca1b2c47deb2153b62e7?d=identicon)[yokov](/maintainers/yokov)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[cleaniquecoders/profile

Common Profile Information

143.0k3](/packages/cleaniquecoders-profile)

PHPackages © 2026

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