NativePHP

Setup

Install tether/nativephp-client, register the NativePHP mobile plugin, configure Composer access, and enable automatic sync in a NativePHP app.

Set up NativePHP offline sync by installing the commercial tether/nativephp-client add-on, registering the mobile plugin, and enabling automatic sync triggers for app resume, network restore, and background work.


Prerequisites

Your NativePHP app must already have tether/client configured and working. See the Client Setup guide first.

Because tether/nativephp-client is a commercial package, configure Composer with your Tether repository credentials before installing it. Open My account, create a Composer token, then add the repository and HTTP basic credentials shown there.


Installation

composer require tether/nativephp-client
php artisan native:plugin:register tether/nativephp-client
php artisan vendor:publish --tag=tether-nativephp-config

The package registers its service provider automatically through Laravel package discovery.


What gets registered

TetherNativephpClientServiceProvider is auto-registered. It:

  1. Merges the tether-nativephp config.
  2. Registers the app-resume sync listener when auto_sync_on_resume = true.
  3. Registers the connectivity-restored sync listener when auto_sync_on_connectivity = true.
  4. Registers background sync scheduling when background_sync = true.

All of this happens automatically. In a normal app, you install the package, publish the config, and adjust the config values you care about.


Basic configuration

After publishing the config, decide which sync triggers your app should use:

'auto_sync_on_resume' => true,
'resume_cooldown' => 30,
'auto_sync_on_connectivity' => true,
'background_sync' => false,

Most apps can keep the defaults:

  • Resume sync pushes local changes when the user opens the app again.
  • Connectivity sync pushes local changes once the device is back online.
  • Background sync is opt-in because it requires nativephp/mobile-background-tasks.

Verifying the installation

After installing, run your NativePHP app and verify the Laravel log or queue output when you:

  1. Send the app to the background and open it again.
  2. Disconnect and reconnect the device's network.

In both cases, the package should dispatch PushJob when the corresponding trigger is enabled.