n1ebieski/logic-captcha
Composer 安装命令:
composer require n1ebieski/logic-captcha
包简介
Laravel 5 Logic Captcha Package
README 文档
README
A package-plugin extends Captcha for Laravel 5 by Muharrem ERİN for Laravel 5.
New features
- New option - customizable logic captcha (question -> answer1 or answer2 ...)
- Support for multiple captcha on single page by Id (only for Base64 method)
- A simple asset in jquery to reload captcha (both method - Base64 and Src by Controller)
Installation
- Install the package via Composer:
composer require n1ebieski/logic-captcha
- Publish the configuration file, resources and assets via artisan:
php artisan vendor:publish --provider="N1ebieski\LogicCaptcha\Providers\LogicCaptchaServiceProvider"
Preview
Configuration
config/logic_captcha.php
return [ 'default' => [ 'math' => false, 'logic' => true, 'width' => 300, 'height' => 80, ], 'logic' => [ 'questions' => [ 'Color of the sky?' => [ 'blue' ], 'Highest mountain on Earth?' => [ 'Mount Everest', 'MountEverest' ], 'Natural enemy of the cat?' => [ 'dog', 'human', 'lol' ] ] ] ];
Example Usage
Simple example. Of course, I suggest using the form requests, route-controller-view pattern and assets minified by webpack.
use Illuminate\Http\Request; use Illuminate\Support\Facades\Route; Route::any('captcha-test', function(Request $request) { if (request()->getMethod() == 'POST') { $rules = ['captcha' => 'required|captcha']; $validator = validator()->make(request()->all(), $rules); if ($validator->fails()) { echo '<p style="color: #ff0000;">Incorrect!</p>'; } else { echo '<p style="color: #00ff30;">Matched :)</p>'; } } $form = '<p><b>Multi Captcha on one page by Base64</b></p>'; $form .= '<form method="post" action="captcha-test">'; $form .= '<input type="hidden" name="_token" value="' . csrf_token() . '">'; $form .= '<p><img src="' . captcha_base64(0) . '"></p>'; $form .= '<p><input type="hidden" value="0" name="captcha_id"></p>'; $form .= '<p><input type="text" name="captcha"></p>'; $form .= '<p><button type="submit">Check</button> <button class="reload_captcha_base64" type="button" data-route="' . route('captcha.base64', ['default']) . '">Reload</button></p>'; $form .= '</form>'; $form .= '<form method="post" action="captcha-test">'; $form .= '<input type="hidden" name="_token" value="' . csrf_token() . '">'; $form .= '<p><img src="' . captcha_base64(1) . '"></p>'; $form .= '<p><input type="hidden" value="1" name="captcha_id"></p>'; $form .= '<p><input type="text" name="captcha"></p>'; $form .= '<p><button type="submit">Check</button> <button class="reload_captcha_base64" type="button" data-route="' . route('captcha.base64', ['default']) . '">Reload</button></p>'; $form .= '</form>'; $form .= '<p><b>Single Captcha by Async Src Controller</b></p>'; $form .= '<form method="post" action="captcha-test">'; $form .= '<input type="hidden" name="_token" value="' . csrf_token() . '">'; $form .= '<p>' . captcha_img() . '</p>'; $form .= '<p><input type="text" name="captcha"></p>'; $form .= '<p><button type="submit">Check</button> <button class="reload_captcha_img" type="button">Reload</button></p>'; $form .= '</form>'; $form .= '<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>'; $form .= '<script src="' . asset('js/vendor/logic-captcha/captcha_reload.js') . '"></script>'; return $form; });
Copyright and License
Base package Captcha for Laravel 5 was written by Muharrem ERİN.
Package Logic Captcha for Laravel 5 was written by Mariusz Wysokiński and is released under the MIT License.
n1ebieski/logic-captcha 适用场景与选型建议
n1ebieski/logic-captcha 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 484 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 08 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「captcha」 「laravel5 Security」 「laravel5 Captcha」 「laravel logic captcha」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 n1ebieski/logic-captcha 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 n1ebieski/logic-captcha 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 n1ebieski/logic-captcha 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
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.
Provide a way to secure accesses to all routes of an symfony application.
Laravel helpers for dev
Two Captcha
It's a barebone security class written on PHP
统计信息
- 总下载量: 484
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 9
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-08-15