PHPackages                             nativephp/mobile-browser - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. nativephp/mobile-browser

ActiveNativephp-plugin[HTTP &amp; Networking](/categories/http)

nativephp/mobile-browser
========================

Browser functionality for NativePHP Mobile - open URLs in system browser, in-app browser, and OAuth authentication

1.0.2(1mo ago)49.4k↑178.7%2MITPHPPHP ^8.2CI passing

Since Jan 19Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/NativePHP/mobile-browser)[ Packagist](https://packagist.org/packages/nativephp/mobile-browser)[ RSS](/packages/nativephp-mobile-browser/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (3)Dependencies (5)Versions (4)Used By (0)

Browser Plugin for NativePHP Mobile
===================================

[](#browser-plugin-for-nativephp-mobile)

Open URLs in system browser, in-app browser (SFSafariViewController/Chrome Custom Tabs), and OAuth authentication sessions.

Overview
--------

[](#overview)

The Browser API provides three methods for opening URLs, each designed for specific use cases: in-app browsing, system browser navigation, and web authentication flows.

Installation
------------

[](#installation)

```
composer require nativephp/mobile-browser
```

Usage
-----

[](#usage)

### PHP (Livewire/Blade)

[](#php-livewireblade)

```
use Native\Mobile\Facades\Browser;

// Open in in-app browser
Browser::inApp('https://nativephp.com/mobile');

// Open in system browser
Browser::open('https://nativephp.com/mobile');

// OAuth authentication
Browser::auth('https://provider.com/oauth/authorize?client_id=123&redirect_uri=nativephp://127.0.0.1/auth/callback');
```

### JavaScript (Vue/React/Inertia)

[](#javascript-vuereactinertia)

```
import { Browser } from '#nativephp';

// Open in in-app browser
await Browser.inApp('https://nativephp.com/mobile');

// Open in system browser
await Browser.open('https://nativephp.com/mobile');

// OAuth authentication
await Browser.auth('https://provider.com/oauth/authorize?client_id=123&redirect_uri=nativephp://127.0.0.1/auth/callback');
```

Methods
-------

[](#methods)

### `inApp()`

[](#inapp)

Opens a URL in an embedded browser within your app using Custom Tabs (Android) or SFSafariViewController (iOS).

### `open()`

[](#open)

Opens a URL in the device's default browser app, leaving your application entirely.

### `auth()`

[](#auth)

Opens a URL in a specialized authentication browser designed for OAuth flows with automatic `nativephp://` redirect handling.

Use Cases
---------

[](#use-cases)

### When to Use Each Method

[](#when-to-use-each-method)

**`inApp()`** - Keep users within your app experience:

- Documentation, help pages, terms of service
- External content that relates to your app
- When you want users to easily return to your app

**`open()`** - Full browser experience needed:

- Complex web applications
- Content requiring specific browser features
- When users need bookmarking or sharing capabilities

**`auth()`** - OAuth authentication flows:

- Login with WorkOS, Auth0, Google, Facebook, etc.
- Secure authentication with automatic redirects
- Isolated browser session for security

Testing
-------

[](#testing)

The plugin extends the NativePHP testing suite with browser-specific helpers, so your app tests can assert what was opened without knowing any bridge internals:

```
use Native\Mobile\Testing\Native;

it('opens the docs in the in-app browser', function () {
    Native::fakeBridge()->respondTo('Browser.OpenInApp', ['success' => true]);

    Native::test(HelpScreen::class)
        ->tap('View documentation')
        ->assertOpenedInApp('https://nativephp.com/docs');
});

it('starts the oauth flow', function () {
    Native::fakeBridge()->respondTo('Browser.OpenAuth', ['success' => true]);

    Native::test(LoginScreen::class)
        ->tap('Continue with Google')
        ->assertOpenedAuth();
});

it('does nothing until the button is tapped', function () {
    Native::test(LoginScreen::class)
        ->assertNothingBrowsed();
});
```

### Helpers

[](#helpers)

- `assertBrowsed(?string $url = null)` — assert a URL was opened, via `open()`, `inApp()`, or `auth()` — any of the three, or exactly `$url` when given.
- `assertOpenedInApp(?string $url = null)` — assert a URL was opened in the in-app browser (`inApp()`), or exactly `$url` when given.
- `assertOpenedAuth(?string $url = null)` — assert a URL was opened in an authentication session (`auth()`), or exactly `$url` when given.
- `assertNothingBrowsed()` — assert nothing was opened by any of the three methods.

`open()`, `inApp()`, and `auth()` are fire-and-forget calls with nothing to read back beyond success/failure, so there's no `with*()` helper to fake a response — script it directly when a test needs `open()`/`inApp()`/`auth()` to return `true`:

```
Native::fakeBridge()->respondTo('Browser.Open', ['success' => true]);
```

The helpers are available on `Native::fakeBridge()` and chain directly off `Native::test(...)`. They register automatically while running tests (requires a core with a macroable FakeBridge; on older cores they simply don't register).

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance93

Actively maintained with recent releases

Popularity32

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 78.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~89 days

Total

3

Last Release

33d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9ab43d3432a80f0f41fe7015280f6024ff13fe8c2306cf114a1fbc91a4cd6f35?d=identicon)[simonhamp](/maintainers/simonhamp)

---

Top Contributors

[![shanerbaner82](https://avatars.githubusercontent.com/u/5580860?v=4)](https://github.com/shanerbaner82 "shanerbaner82 (11 commits)")[![simonhamp](https://avatars.githubusercontent.com/u/31628?v=4)](https://github.com/simonhamp "simonhamp (3 commits)")

---

Tags

nativephpnativephp-mobilenativephp-plugin

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/nativephp-mobile-browser/health.svg)

```
[![Health](https://phpackages.com/badges/nativephp-mobile-browser/health.svg)](https://phpackages.com/packages/nativephp-mobile-browser)
```

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25026.8M85](/packages/php-http-cache-plugin)[httpsoft/http-message

Strict and fast implementation of PSR-7 and PSR-17

85997.3k131](/packages/httpsoft-http-message)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
