rpwebdevelopment/webview-detect
Composer 安装命令:
composer require rpwebdevelopment/webview-detect
包简介
Webview detection package
README 文档
README
Package designed to handle parsing of User-Agent headers to determine if users are accessing applications vie WebView or not.
Installation
You can install the package via composer:
composer require rpwebdevelopment/webview-detect
Usage
Basic usage is as follows:
use RPWebDevelopment\WebviewDetect\Facades\WebviewDetect; $userAgent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148'; $isWebView = WebviewDetect::forUserAgent($userAgent)->isWebView();
Additionally we can initialise the facade with a request for simplified handling within controller/middleware classes:
namespace App\Http\Middleware; use Illuminate\Http\Request; use RPWebDevelopment\WebviewDetect\Facades\WebviewDetect; class FooMiddleware { public function handle(Request $request, Closure $next) { $isWebview = WebviewDetect::forRequest($request)->isWebView(); // business logic return $next($request); } }
Notes
While efforts have been taken to make the functionality as comprehensive and reliable as possible there will undoubtedly be edge cases that have been missed (or future browsers) that are incorrectly validated. As such it is recommended to treat responses as advisory only.
Credits
Changelog
Please see CHANGELOG for more information on what has changed recently.
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 293
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-20