1. Go to this page and download the library: Download nativephp/mobile-browser library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nativephp / mobile-browser example snippets
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');
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();
});