Setup
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:
- Merges the
tether-nativephpconfig. - Registers the app-resume sync listener when
auto_sync_on_resume = true. - Registers the connectivity-restored sync listener when
auto_sync_on_connectivity = true. - 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:
- Send the app to the background and open it again.
- Disconnect and reconnect the device's network.
In both cases, the package should dispatch PushJob when the corresponding trigger is enabled.
Overview
See how tether/nativephp-client adds automatic offline sync triggers for NativePHP mobile apps on app resume, network restore, and background tasks.
Configuration
Configure NativePHP offline sync triggers for app resume, connectivity restore, background scheduling, cooldowns, and network constraints.