PHPackages                             aureuserp/nativephp-remote - 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. [API Development](/categories/api)
4. /
5. aureuserp/nativephp-remote

ActiveLibrary[API Development](/categories/api)

aureuserp/nativephp-remote
==========================

NativePHP hosted remote mode support — connect NativePHP mobile apps to a centralized web server

v0.1.0(1w ago)09↓100%MITKotlinPHP ^8.2

Since May 28Pushed 1w agoCompare

[ Source](https://github.com/aureuserp/nativephp-remote)[ Packagist](https://packagist.org/packages/aureuserp/nativephp-remote)[ RSS](/packages/aureuserp-nativephp-remote/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

NativePHP Remote
================

[](#nativephp-remote)

Connect NativePHP mobile apps to a centralized web server instead of running PHP on-device. Build one Laravel app that works as both a web app and a native mobile app.

How It Works
------------

[](#how-it-works)

NativePHP normally bundles your Laravel app and runs it locally on the device. This package patches NativePHP so the mobile WebView connects to your existing web server instead. All requests go to your server — the native shell provides the mobile experience (top bar, side nav, camera, haptics, etc.).

```
┌─────────────────┐       ┌──────────────────┐
│  Mobile Device   │       │   Your Server    │
│                  │       │                  │
│  NativePHP Shell │──────▶│  Laravel App     │
│  (WebView)       │  HTTP │  (same codebase) │
│                  │◀──────│                  │
│  Native Top Bar  │       │  Livewire/Blade  │
│  Native Side Nav │       │  Filament        │
│  Haptics/Toast   │       │                  │
└─────────────────┘       └──────────────────┘

```

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 11 or 12
- [NativePHP Mobile](https://nativephp.com) ^3.0

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

[](#installation)

```
composer require webkul/nativephp-remote
```

The service provider is auto-discovered. To publish the config:

```
php artisan vendor:publish --tag=nativephp-remote-config
```

Setup
-----

[](#setup)

### 1. Configure NativePHP Start URL

[](#1-configure-nativephp-start-url)

In your `config/nativephp.php` (or `.env` on the device), set the start URL to your server:

```
'start_url' => env('NATIVEPHP_START_URL', 'https://your-app.com/mobile?nativephp=1'),
```

The `?nativephp=1` parameter is required on the first request — it sets a cookie so subsequent requests are recognized as native.

### 2. Patch NativePHP

[](#2-patch-nativephp)

After installing or updating NativePHP, run:

```
php artisan nativephp:patch-remote --force
```

This copies patched Kotlin/Swift files that enable:

- Hosted remote URL routing (WebView connects to your server)
- HTTPS enforcement in production
- Camera permission handling
- Smooth WebView scrolling
- Hash-based navigation for native actions
- JS-to-native bridge (vibrate, toast, native UI updates)
- `/_native/` API routing to local PHP runtime

Without `--force`, it applies incremental patches to existing files (useful after NativePHP updates).

### 3. Add Middleware

[](#3-add-middleware)

Add the middleware to routes that should support native mode:

```
use Webkul\NativephpRemote\Http\Middleware\PersistNativeShell;
use Webkul\NativephpRemote\Http\Middleware\RenderHostedNativeUi;

Route::middleware(['web', PersistNativeShell::class, RenderHostedNativeUi::class])
    ->group(function () {
        // Your routes here
    });
```

- **PersistNativeShell** — Sets a cookie on the first `?nativephp=1` request so the app is recognized as native on subsequent requests.
- **RenderHostedNativeUi** — Sends Edge component data via `x-native-ui` response header and renders it in the DOM for native UI hydration.

### 4. Include Bridge Scripts

[](#4-include-bridge-scripts)

Add the bridge scripts component to your layout, before ``:

```

```

This provides:

- `window.BarcodeNative.vibrate()` — Trigger device haptic feedback
- `window.BarcodeNative.toast(message, duration)` — Show native toast (`'short'` or `'long'`)
- Automatic native UI re-hydration after Livewire SPA navigation

### 5. Add Native UI JSON to Layout

[](#5-add-native-ui-json-to-layout)

For native top bar, side nav, and bottom nav to work, include the Edge data in your layout:

```
@if (\Webkul\NativephpRemote\Support\NativeRemote::usesNativeNavigation())
    {{-- Your native sidebar/header blade components here --}}

        @json(\Native\Mobile\Edge\Edge::all())

@endif
```

PHP Helpers
-----------

[](#php-helpers)

```
use Webkul\NativephpRemote\Support\NativeRemote;

// Check if the request is from a native app
NativeRemote::requestIsNative();

// Check if native navigation (top bar, side nav) should be rendered
NativeRemote::usesNativeNavigation();

// Check if the JS bridge (vibrate, toast) is available
NativeRemote::bridgeEnabled();

// Check if running in hosted remote mode
NativeRemote::usesHostedRemoteShell();

// Generate URLs that work in both native and web mode
NativeRemote::navigationUrl('my.route', ['param' => 1]);

// Generate a URL with a hash action (e.g., for triggering a scanner)
NativeRemote::hashActionUrl('scan-barcode');
// Returns: "https://your-app.com/current-page#scan-barcode"
```

JavaScript Bridge
-----------------

[](#javascript-bridge)

After including ``:

```
// Haptic feedback (50ms vibration on Android, medium impact on iOS)
window.BarcodeNative.vibrate();

// Toast message
window.BarcodeNative.toast('Item scanned!');
window.BarcodeNative.toast('Error occurred', 'long');

// Check if native bridge is available
if (window.BarcodeNative.enabled) {
    // Running in native app
}
```

Dual-Mode Pages
---------------

[](#dual-mode-pages)

Build pages that work both as web and native:

```
@unless (\Webkul\NativephpRemote\Support\NativeRemote::usesNativeNavigation())
    {{-- Web header/sidebar --}}
    ...
@endunless

{{-- Main content — shared between web and native --}}

    {{ $slot }}

```

Safe Area Insets
----------------

[](#safe-area-insets)

The native shell injects CSS variables for device safe areas (notch, navigation bar):

```
/* Available CSS variables */
var(--inset-top)
var(--inset-right)
var(--inset-bottom)
var(--inset-left)

/* Example: fixed bottom bar that respects system navigation */
.bottom-bar {
    position: fixed;
    bottom: 0;
    padding-bottom: calc(0.5rem + var(--inset-bottom, 0px));
}
```

Hash-Based Actions
------------------

[](#hash-based-actions)

Trigger native actions via URL hash fragments. Useful for native top bar buttons:

```

```

Then listen in JavaScript:

```
window.addEventListener('hashchange', () => {
    if (window.location.hash === '#scan-barcode') {
        // Start scanner
        window.history.replaceState({}, '', window.location.pathname + window.location.search);
    }
});
```

Configuration
-------------

[](#configuration)

```
// config/nativephp-remote.php

return [
    // Cookie name for native shell detection
    'cookie_name' => env('NATIVEPHP_REMOTE_COOKIE', 'nativephp_remote_shell'),

    // Cookie lifetime in minutes (default: 30 days)
    'cookie_lifetime' => 60 * 24 * 30,

    // Android permissions added during patching
    'android_permissions' => [
        'android.permission.CAMERA',
        'android.permission.VIBRATE',
    ],

    // iOS permission descriptions
    'ios_permissions' => [
        'NSCameraUsageDescription' => 'This app uses your camera to scan barcodes and QR codes.',
    ],
];
```

What the Patcher Does
---------------------

[](#what-the-patcher-does)

Running `php artisan nativephp:patch-remote --force` applies these changes to NativePHP's native code:

FileChanges`AndroidManifest.xml`Adds CAMERA and VIBRATE permissions`LaravelEnvironment.kt`Hosted remote host detection, HTTPS normalization, circular dependency fix`MainActivity.kt`Hosted remote URL loading, hash-aware navigation, hardware-accelerated WebView, JS bridge (vibrate, toast, updateNativeUI)`WebViewManager.kt`Hosted remote URL routing, camera permission handling, `/_native/` API interception, native UI DOM hydration`NativeTopBar.kt`Hosted remote external URL detection`NativeSideNav.kt`Hosted remote external URL detection`ContentView.swift`Fragment-preserving URL extraction, hash-aware navigation, native UI/haptic/toast handlers`NativePHPApp.swift`Hosted remote host detection, HTTPS normalization`NativeSideNav.swift` (iOS)Hosted remote external URL detectionLicense
-------

[](#license)

MIT

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance98

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

12d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b12adc21e990c055e325a3c07339b3d4d313efd49f98a768c1a86fc7776f2b86?d=identicon)[Jitendra Singh](/maintainers/Jitendra%20Singh)

---

Top Contributors

[![jitendra-webkul](https://avatars.githubusercontent.com/u/39991107?v=4)](https://github.com/jitendra-webkul "jitendra-webkul (3 commits)")

### Embed Badge

![Health badge](/badges/aureuserp-nativephp-remote/health.svg)

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

###  Alternatives

[defstudio/telegraph

A laravel facade to interact with Telegram Bots

815320.5k3](/packages/defstudio-telegraph)[riclep/laravel-storyblok

A Laravel wrapper around the Storyblok API to provide a familiar experience for Laravel devs

6277.0k5](/packages/riclep-laravel-storyblok)[jasara/php-amzn-selling-partner-api

A fluent interface for Amazon's Selling Partner API in PHP

1348.1k1](/packages/jasara-php-amzn-selling-partner-api)[rapidez/core

Rapidez Core

1822.4k65](/packages/rapidez-core)

PHPackages © 2026

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