Download the PHP package nativephp/mobile-browser without Composer
On this page you can find all versions of the php package nativephp/mobile-browser. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nativephp/mobile-browser
More information about nativephp/mobile-browser
Files in nativephp/mobile-browser
Package mobile-browser
Short Description Browser functionality for NativePHP Mobile - open URLs in system browser, in-app browser, and OAuth authentication
License MIT
Informations about the package mobile-browser
Browser Plugin for NativePHP Mobile
Open URLs in system browser, in-app browser (SFSafariViewController/Chrome Custom Tabs), and OAuth authentication sessions.
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
Usage
PHP (Livewire/Blade)
JavaScript (Vue/React/Inertia)
Methods
inApp()
Opens a URL in an embedded browser within your app using Custom Tabs (Android) or SFSafariViewController (iOS).
open()
Opens a URL in the device's default browser app, leaving your application entirely.
auth()
Opens a URL in a specialized authentication browser designed for OAuth flows with automatic nativephp:// redirect handling.
Use Cases
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
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:
Helpers
assertBrowsed(?string $url = null)— assert a URL was opened, viaopen(),inApp(), orauth()— any of the three, or exactly$urlwhen given.assertOpenedInApp(?string $url = null)— assert a URL was opened in the in-app browser (inApp()), or exactly$urlwhen given.assertOpenedAuth(?string $url = null)— assert a URL was opened in an authentication session (auth()), or exactly$urlwhen 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:
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).