rpwebdevelopment/webview-detect

Webview detection package

Fund package maintenance!
rpwebdevelopment

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/rpwebdevelopment/webview-detect

1.0.0 2026-02-20 15:53 UTC

This package is auto-updated.

Last update: 2026-02-20 15:54:39 UTC


README

Packagist Version Packagist Downloads GitHub Tests Action Status License: MIT

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.