hiraeth/middleware-browser-redirect 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

  1. Package configuration and middleware configuration will be copied on install
  2. 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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-05-15