bonecms/laravel-captcha
Composer 安装命令:
composer require bonecms/laravel-captcha
包简介
Captcha integration for Laravel
关键字:
README 文档
README
Installing Laravel Captcha Composer Package
Note: If you do not have Composer yet, you can install it by following the instructions on https://getcomposer.org
Step 1. Install package
composer require bonecms/laravel-captcha
| Captcha | Laravel |
|---|---|
| v2.2 | 5.5 - 9.x |
| v2.1 | 5.4 |
| v1.1 | 5.3 and below |
Step 2 for Laravel 5.5 and below. Register the Laravel Captcha service provider
{LARAVEL_ROOT}/config/app.php:
'providers' => [ ... Igoshev\Captcha\Providers\CaptchaServiceProvider::class, ],
Using Laravel Captcha
Generate a Captcha markup in your Controller:
<?php namespace App\Http\Controllers; use App\Http\Controllers\Controller; class MyController extends Controller { public function getExample() { return view('myView'); } }
Showing a Captcha in a View:
... @captcha <input type="text" id="captcha" name="captcha" autocomplete="off"> ...
Check user input during form submission:
<?php namespace App\Http\Controllers; use App\Http\Controllers\Controller; use Illuminate\Http\Request; class MyController extends Controller { public function getExample() { return view('myView'); } public function postExample(Request $request) { $this->validate($request, [ 'captcha' => 'required|captcha' ]); // Validation passed } }
Configuration
php artisan vendor:publish --tag=bone-captcha-config
<?php return [ /* |-------------------------------------------------------------------------- | Captcha middleware |-------------------------------------------------------------------------- | */ 'middleware' => ['web'], /* |-------------------------------------------------------------------------- | Captcha routes |-------------------------------------------------------------------------- | */ 'routes' => [ 'image' => 'captcha/image', 'image_tag' => 'captcha/image_tag' ], /* |-------------------------------------------------------------------------- | Blade directive |-------------------------------------------------------------------------- | You can use blade directive @captcha for rendering captcha. | */ 'blade' => 'captcha', /* |-------------------------------------------------------------------------- | Validator name |-------------------------------------------------------------------------- | */ 'validator' => 'captcha', /* |-------------------------------------------------------------------------- | Captcha generator. |-------------------------------------------------------------------------- | Must implement GeneratorInterface. | */ 'generator' => \Igoshev\Captcha\Captcha\Generator\GeneratorWaves::class, /* |-------------------------------------------------------------------------- | Storage code. |-------------------------------------------------------------------------- | Must implement StorageInterface. | */ 'storage' => \Igoshev\Captcha\Captcha\Storage\SessionStorage::class, /* |-------------------------------------------------------------------------- | Code generator. |-------------------------------------------------------------------------- | Must implement CodeInterface. | */ 'code' => \Igoshev\Captcha\Captcha\Code\SimpleCode::class, /* |-------------------------------------------------------------------------- | Font |-------------------------------------------------------------------------- | Supported: "IndiraK". | */ 'font' => base_path('vendor/bonecms/laravel-captcha/src/resources/fonts/IndiraK.ttf'), /* |-------------------------------------------------------------------------- | Font size |-------------------------------------------------------------------------- | Font size in pixels. | */ 'fontSize' => 26, /* |-------------------------------------------------------------------------- | Letter spacing |-------------------------------------------------------------------------- | Spacing between letters in pixels. | */ 'letterSpacing' => 2, /* |-------------------------------------------------------------------------- | Code Length |-------------------------------------------------------------------------- | You can specify an array or integer. | */ 'length' => [4, 5], /* |-------------------------------------------------------------------------- | Displayed chars |-------------------------------------------------------------------------- | Enter the different characters. | */ 'chars' => 'QSFHTRPAJKLMZXCVBNabdefhxktyzj23456789', /* |-------------------------------------------------------------------------- | Image Size |-------------------------------------------------------------------------- | Captcha image size can be controlled by setting the width | and height properties. | | */ 'width' => 180, 'height' => 50, /* |-------------------------------------------------------------------------- | Background Captcha |-------------------------------------------------------------------------- | You can specify an array or string. | */ 'background' => 'f2f2f2', /* |-------------------------------------------------------------------------- | Colors characters |-------------------------------------------------------------------------- | You can specify an array or string. | */ 'colors' => '2980b9', /* |-------------------------------------------------------------------------- | Scratches |-------------------------------------------------------------------------- | The number of scratches displayed in the Captcha. | */ 'scratches' => [1, 6], /* |-------------------------------------------------------------------------- | Id of the Captcha code input textbox |-------------------------------------------------------------------------- | After updating the Captcha focus will be set on an element with this id. | */ 'inputId' => 'captcha', ];
Localization
Supported languages (17):
- Arabic
- Chinese
- Dutch
- English
- French
- German
- Hindi
- Indonesian
- Italian
- Japanese
- Korean
- Persian
- Portuguese
- Russian
- Spanish
- Turkish
- Ukrainian
php artisan vendor:publish --tag=bone-captcha-lang
View
php artisan vendor:publish --tag=bone-captcha-views
Donation
If this project help you reduce time to develop, you can give me a cup of coffee :)
bonecms/laravel-captcha 适用场景与选型建议
bonecms/laravel-captcha 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 141.73k 次下载、GitHub Stars 达 76, 最近一次更新时间为 2015 年 05 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「captcha」 「Laravel Captcha」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 bonecms/laravel-captcha 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bonecms/laravel-captcha 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 bonecms/laravel-captcha 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Diese Contao 4 Erweiterung stellt Google reCAPTCHA V2 in Form eines neuen Formularfeldes im Formulargenerator bereit. This extension provides Google reCAPTCHA V2 in the form of a new form field in the form generator of Contao Open Source CMS.
Two Captcha
Laravel 5 Securimage helper
Zend Captcha bundle
Alfabank REST API integration
Laravel Package for the ArCaptcha
统计信息
- 总下载量: 141.73k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 77
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-05-30











