Offline Sync
Kromaric
NativePHP^0.8.0PHP^8.1Laravel10 | 11 | 12iOS14.0+Android24+
Offline-first synchronization plugin for NativePHP Mobile. Handles queuing, bidirectional sync, and conflict resolution so you can focus on building features.
Features
- Automatic queue management — operations queued when offline
- Bidirectional sync — push local changes and pull remote updates
- 4 conflict resolution strategies: Server wins, Client wins, Last write wins, Merge
- Auto-connectivity monitoring — syncs automatically when connection returns
- Background sync (iOS/Android)
- HTTPS enforcement, auth-agnostic design
- Laravel events, logs, and Artisan commands
- Zero native code required — all Kotlin + Swift bridges included
Installation
composer require techparse/offline-sync
php artisan native:plugin:register techparse/offline-sync
php artisan vendor:publish --tag=offline-sync-config
php artisan migrate
Usage
use Techparse\OfflineSync\Facades\OfflineSync;
// Queue an operation
OfflineSync::queue('create', '/api/posts', ['title' => 'Hello']);
// Force sync now
OfflineSync::sync();
// Get sync status
$status = OfflineSync::status();
Events
SyncCompleted— sync round finished successfullySyncFailed— sync attempt failed with error detailsConflictDetected— a conflict was found; includes the resolution appliedQueueFlushed— all queued operations were processed