定制 visavi/captcha 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

visavi/captcha

Composer 安装命令:

composer require visavi/captcha

包简介

Animated captcha generator

README 文档

README

Latest Stable Version Total Downloads Latest Unstable Version License

Examples

Default

example1 example2 example3

Advanced

example4 example5 example6

Mini

example7 example8 example9

Methods

  • getPhrase - Get phrase
  • inline - Get captcha as a base64 data URI (image/gif), ready for an inline <img src>
  • setWidth - Image width, px (Optional, default 150px)
  • setHeight - Image height, px (Optional, default 40px)
  • setTextColor - Text color (Optional)
  • setBackgroundColor - Background color (Optional)
  • setFont - Font path (Optional)
  • setWindowWidth - Window width, px (Optional, default 75px)
  • setPixelPerFrame - Window shift per frame, px (Optional, default 15px)
  • setDelayBetweenFrames - Time between frames, in hundredths of a second (Optional, default 20 = 0.2s)

Code default

header('Content-Type: image/gif');

$captcha = new CaptchaBuilder();
$_SESSION['captcha'] = $captcha->getPhrase();

return $captcha->render();

Code advanced

header('Content-Type: image/gif');

$phrase = new PhraseBuilder();
$phrase = $phrase->getPhrase(5, '1234567890');

$captcha = new CaptchaBuilder($phrase);
$captcha
    ->setWidth(150)
    ->setHeight(50)
    ->setTextColor(0, 0, 0)
    ->setBackgroundColor(255, 255, 255)
    ->setFont('/path-to-font')
    ->setWindowWidth(60)
    ->setPixelPerFrame(15)
    ->setDelayBetweenFrames(20);

$_SESSION['captcha'] = $captcha->getPhrase();

return $captcha->render();

Code inline

No headers needed — the captcha is embedded straight into the page:

$captcha = new CaptchaBuilder();
$_SESSION['captcha'] = $captcha->getPhrase();

echo '<img src="' . $captcha->inline() . '" alt="captcha">';

Installation

composer require visavi/captcha

License

The class is open-sourced software licensed under the MIT license

统计信息

  • 总下载量: 2.94k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 4
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-09-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固