hirenkeraliya/lara-captcha
Composer 安装命令:
composer require hirenkeraliya/lara-captcha
包简介
Laravel custom recaptcha.
README 文档
README
Laravel Captcha (Laravel 9.x)
Lara-Captcha is a reliable and easy-to-use package for preventing bot submissions and enhancing the security of public forms in Laravel. With its simple integration and multiple customization options, it's a great choice for developers looking to improve the safety of their forms.
Requirements
| PHP | Laravel | Package |
|---|---|---|
| 8.1+ | 9.x | v1.0.0 |
Features
- Easy integration with Laravel forms
- Supports multiple configurations for customization
- Provides effective protection against bot submissions
- Minimal code changes required for implementation
- Regular updates and bug fixes from the author
- Lightweight package for efficient performance
Usage
Here's an example of how to use Lara-Captcha in your Laravel form:
<form method="POST" action="/submit-form">
@csrf
@captcha
<input type="text" name="name" placeholder="Name"><br>
<input type="email" name="email" placeholder="Email"><br>
<button type="submit">Submit</button>
</form>
Installation
Follow these steps to install the package:
- Run the following command in your terminal/cmd:
composer require hirenkeraliya/lara-captcha
- Import the configuration file by running this command in your terminal/cmd:
php artisan vendor:publish --tag=lara-captcha-config
-
Add
@captchain your form after the CSRF token. -
To use the middleware, add the following line to your route:
use Hirenkeraliya\LaraCaptcha\app\Http\Middleware\VerifyCaptcha; Route::post('contact-us', [ContactUsController::class, 'index'])->name('front.contact_us')->middleware(VerifyCaptcha::class);
or You can apply it to multiple routes by utilizing route grouping.
use Hirenkeraliya\LaraCaptcha\app\Http\Middleware\VerifyCaptcha; Route::group(['middleware' => VerifyCaptcha::class], function () { Route::post('contact-us', [ContactUsController::class, 'index'])->name('front.contact_us'); }); Route::middleware([VerifyCaptcha::class])->group(function () { Route::post('contact-us', [ContactUsController::class, 'index'])->name('front.contact_us'); });
That's it! Your form is now secured against bot submissions.
Configuration
Lara-Captcha provides multiple configuration options that you can modify to fit your needs. The default configuration can be found in the config/lara-captcha.php file after running the vendor:publish command.
You can modify the following configuration options:
enabled: The validation can be enabled or disabled.input_name: The name of the input field in your form.error.message: The error message to display when a bot submission is detected.error.status_code: The error status code to display when a bot submission is detected.
Authors
- Hiren Keraliya - Initial work
Support
If you encounter any issues with Lara-Captcha or have suggestions for improvement, feel free to open an issue on the GitHub repository.
Contributing
Contributions to Lara-Captcha are always welcome! To contribute, simply fork the repository, make your changes, and submit a pull request.
License
This project is licensed under the MIT License - see the LICENSE file for details
Special Thanks to
Special thanks to the Laravel community for their support
hirenkeraliya/lara-captcha 适用场景与选型建议
hirenkeraliya/lara-captcha 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 34 次下载、GitHub Stars 达 25, 最近一次更新时间为 2023 年 03 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 hirenkeraliya/lara-captcha 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hirenkeraliya/lara-captcha 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 34
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 25
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-03-04