amstaffix/silex-captcha

此包已被弃用且不再维护。未建议替换包。

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

1.0.2 2016-07-05 21:20 UTC

This package is not auto-updated.

Last update: 2021-07-21 10:52:07 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 string 会话键的名称
route_name gregwar.captcha string 路由名称
phrase_builder null null 或 Gregwar\Captcha\CaptchaBuilderInterface 短语生成器(如果短语为 null,则使用此生成器)
phrase null string 或 null 覆盖短语
width 150 int 图像宽度(像素)
height 40 int 图像高度(像素)
font null string 或 null 字体路径
fingerprint null boolean 不清楚其作用,请参阅源代码
quality 90 int 图像质量
distortion true boolean 启用或禁用扭曲
background null null 或 array(r, g, b) 强制背景颜色(这将禁用许多效果,不推荐使用)
interpolation true boolean 启用或禁用插值,禁用它会更快,但图像看起来会更丑陋
  • 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)