hiraeth/middleware-browser-redirect
最新稳定版本:2.0.0
Composer 安装命令:
composer require hiraeth/middleware-browser-redirect
包简介
Redirect browsers / versions to alternative URLs
README 文档
README
This is a PSR-15 middleware that can be configured with a series of rules to detect specific browsers, versions, and request paths and redirect them to an alternate URL.
Basic Usage
// // The factory must be an actual instance of a response factory, the PSR interface here is // used as a stand in for any particular PSR compatible implementation. // $factory = new Psr\Http\Message\ResponseFactoryInterface(); $browser = new Sinergi\BrowserDetector\Browser(); $redirect = new BrowserRedirect($browser, $factory); $redirect->addRule([ 'target' => '/.*', 'browser' => 'IE', 'version' => '<10', 'redirect' => 'https://getfirefox.com' ]); // // This will actually be executed by your middleware stack, so you probably don't need to do this // yourself. // $response = $redirect->process($request, $handler);
Hiraeth Integration
- Package configuration and middleware configuration will be copied on install
- Additional rules can be added to any config as an array of objects:
[browser] rules = [ { "target": "/.*", "browser": "IE", "version": "<10", "redirect": "https://getfirefox.com" } ]
统计信息
- 总下载量: 6.55k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-05-15