kilte/silex-captcha

此包已被废弃,不再维护。作者建议使用amstaffix/silex-captcha包。

Gregwar/Captcha服务提供者,适用于Silex。

1.0.2 2016-07-05 21:20 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:29:37 UTC


README

Gregwar/Captcha服务提供者,适用于Silex

Downloads License

需求

使用方法

use Kilte\Silex\Captcha\CaptchaServiceProvider;
use Silex\Provider\SessionServiceProvider;
use Silex\Provider\UrlGeneratorServiceProvider;

$app = new Silex\Application();
$captcha = new CaptchaServiceProvider();
$app->register(new SessionServiceProvider)
    ->register(new UrlGeneratorServiceProvider)
    ->register($captcha)
    ->mount('/', $captcha);
$app->run();

选项

默认值 类型 描述
session_key gw_captcha 字符串 会话键的名称
route_name gregwar.captcha 字符串 路由名称
phrase_builder null null或Gregwar\Captcha\CaptchaBuilderInterface 短语构建器(如果短语为null,将使用此构建器)
phrase null 字符串或null 覆盖短语
width 150 整数 图像宽度(像素)
height 40 整数 图像高度(像素)
font null 字符串或null 字体路径
fingerprint null 布尔值 不清楚其功能,请参阅源代码
quality 90 整数 图像质量
distortion true 布尔值 启用或禁用扭曲
background null null或数组(r, g, b) 强制背景颜色(这将禁用许多效果,不推荐使用)
interpolation true 布尔值 启用或禁用插值,禁用将更快,但图像看起来会更丑
  • captcha.builder - Gregwar\Captcha\CaptchaBuilder实例。
  • captcha.test - 执行用户输入检查。(\Closure实例)
  • captcha.image_url - 返回图像的绝对URL。(\Closure实例)

测试

$ composer install
$ vendor/bin/phpunit

变更日志

1.0.1 [31.08.2014]

  • 添加了单元测试
  • PSR-4自动加载
  • 其他小更改

1.0.0 [02.01.2014]

  • 首次发布

贡献

  • 将其分支
  • 创建您的功能分支(git checkout -b awesome-feature)
  • 进行更改
  • 如有必要,编写/更新测试
  • 如有必要,更新README.md
  • 将分支推送到origin(git push origin awesome-feature)
  • 发送拉取请求
  • ???
  • 盈利!!!

不要忘记合并上游更改

git remote add upstream https://github.com/AmsTaFFix/silex-captcha
git checkout master
git pull upstream
git push origin master

现在您可以删除您的分支

git branch -d awesome-feature
git push origin :awesome-feature

许可证

MIT许可证(MIT)