nativephp / mobile-browser
Browser functionality for NativePHP Mobile - open URLs in system browser, in-app browser, and OAuth authentication
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Language:Swift
Type:nativephp-plugin
pkg:composer/nativephp/mobile-browser
Requires
- php: ^8.2
- nativephp/mobile: *
README
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
composer require nativephp/mobile-browser
Usage
PHP (Livewire/Blade)
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)
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
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