craigpotter/laravel-ie-honeypot
Composer 安装命令:
composer require craigpotter/laravel-ie-honeypot
包简介
A small package to capture IE users and recommend they use a modern browser before they hit your site
README 文档
README
Web development should be a progressive journey and let's face it, we all hate Microsoft Internet Explorer. Have you had an issue where users were using IE, getting JS errors and then complaining about how your application is broken? This simple package might be for you then! Laravel IE Honeypot detects requests coming in to the app from users using IE and redirects to a page of your choice. This should be a simple page informing the user their browser is too old or maybe even link them to what they deserve
Installation
You can install the package via composer:
composer require craigpotter/laravel-ie-honeypot
You can publish the config file with:
php artisan vendor:publish --provider="CraigPotter\LaravelIEHoneypot\LaravelIEHoneypotServiceProvider" --tag="ie-honeypot-config"
This is the contents of the published config file:
return [ /** * This switch determines if the honeypot protection should be activated. */ 'enabled' => env('IE_HONEYPOT_ENABLED', true), /** * This switch determines the URL that IE users will get redirect to. */ 'redirect_url' => env('IE_HONEYPOT_REDIRECT_URL', '/ie-trap'), /** * This switch determines if the bypass functionality is enabled. * This will allow use of the @ieBypass directive and allow IE users to access your * site by adding ?ie-bypass=true to a url */ 'bypass_enabled' => env('IE_HONEYPOT_BYPASS_ENABLED', true), ];
Usage
If you want to display a page within your own application to your IE users, you should create a route with a simple layout and add the URL to your configuration file.
There are two main ways to use this package but both involve adding middleware to your routes.
Option 1
Add the middleware to indiviual routes in your routes file or to a group of routes. This option might be best if you have a single point of entry for your application. For example, Users have to login so you might choose to add it to your login route only.
use CraigPotter\LaravelIEHoneypot\CaptureIE; Route::get('/', [YourController::class])->middleware(CaptureIE::class); // OR Route::middleware(CaptureIE::class)->group(function() { // Routes });
Option 2
If you have a lot of routes or just need to keep those pesky IE Users off your site, you could register it as global middleware
// app\Http\Kernal.php protected $middleware = [ // ... \CraigPotter\LaravelIEHoneypot\CaptureIE::class, ];
Bypass
If the bypass_enabled option is true in your configuration, the middleware will allow any user to a path if it has a url param of ie-bypass=true.
You can share links with this bypass if you need to e.g https://your-app.com/contact-us?ie-bypass=true
You also have the option to add this to your own bypass page to allow users to proceed at their own risk.
For example, if a user visits /contact-us with an IE browser, they would be redirected to our redirect_url, you can use the @ieBypass blade directive to automatically generate the bypass url for the initial page visited. In this case, it would be /contact-us?ie-bypass=true.
If we look at the view for that page:
<div> <h1>Use a better browser!> <a href="@ieBypass">Click here to proceed at your own risk</a> </div>
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
craigpotter/laravel-ie-honeypot 适用场景与选型建议
craigpotter/laravel-ie-honeypot 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 3, 最近一次更新时间为 2021 年 04 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「craigpotter」 「laravel-ie-honeypot」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 craigpotter/laravel-ie-honeypot 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 craigpotter/laravel-ie-honeypot 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-04-23