Download the PHP package techparse/offline-sync without Composer
On this page you can find all versions of the php package techparse/offline-sync. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download techparse/offline-sync
More information about techparse/offline-sync
Files in techparse/offline-sync
Package offline-sync
Short Description Offline-first synchronization plugin for NativePHP Mobile
License MIT
Informations about the package offline-sync
NativePHP Offline Sync & Backup
Offline-first synchronization plugin for NativePHP Mobile applications.
Stop fighting with offline data. This plugin handles queuing, sync, and conflicts so you can focus on building features. Works out-of-the-box with zero native code required.
✨ Features
- ✅ Automatic Queue Management - Operations are automatically 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 - Works even when app is closed (iOS/Android)
- ✅ Secure by Default - HTTPS enforcement, auth-agnostic design (your app controls auth)
- ✅ Observable - Laravel events, logs, Artisan commands
- ✅ Zero Native Code - All native bridges included (Kotlin + Swift)
📋 Requirements
- PHP ≥ 8.1
- Laravel ≥ 10.0
- NativePHP ≥ 0.8.0
- iOS ≥ 14.0
- Android API Level ≥ 24 (Android 7.0)
🚀 Installation
1. Install via Composer
2. Register the Plugin
3. Publish Configuration
4. Run Migrations
5. Configure Your API
Edit .env:
📖 Quick Start
1. Add Syncable Trait to Your Models
2. Map Resources in Config
Edit config/offline-sync.php:
3. Use It!
🎯 Usage
Automatic Syncing
With the Syncable trait, all create/update/delete operations are automatically queued:
Manual Syncing
Queue Management
Artisan Commands
⚔️ Conflict Resolution
Configure in config/offline-sync.php:
Available Strategies
| Strategy | Description | Best For |
|---|---|---|
| server_wins | Server data always overwrites local | Critical data, auth |
| client_wins | Local data always overwrites server | User preferences |
| last_write_wins | Newest timestamp wins | Most use cases |
| merge | Intelligent field-level merge | Complex data |
🔐 Security
Authentication
The plugin is auth-agnostic — it does not manage tokens or credentials. Your application is responsible for authentication. To forward an auth header on every sync request, set offline-sync.security.headers at runtime (e.g. in your AppServiceProvider):
This works with any auth system: Laravel Sanctum, Passport, API keys, etc.
HTTPS Enforcement
📡 Backend Setup
Routes
Add to routes/api.php:
Controller
Use the included SyncController or extend it for custom logic.
🔔 Events
Listen to sync events in your application:
Available Events
SyncStarted- Sync process startedSyncCompleted- Sync finished successfullySyncFailed- Sync failedItemQueued- Item added to queueItemSynced- Item synchronizedConflictDetected- Conflict detectedQueuePurged- Old items purged
⚙️ Configuration
See config/offline-sync.php for all options:
- API URL and security headers
- Resource mapping
- Conflict resolution strategies
- Connectivity settings
- Performance tuning
- Security options
- Logging configuration
📱 Native Platform Support
Android (Kotlin)
- Automatic connectivity monitoring
- Background sync with WorkManager
- WiFi-only mode support
- Battery-aware scheduling
iOS (Swift)
- Network framework monitoring
- Background fetch
- App refresh scheduling
- Low power mode respect
All native code is included. No manual native development required.
🧪 Testing
Run the test suite:
Or with coverage:
📚 Documentation
- Installation Guide
- Backend Setup
- Conflict Resolution
- Security Best Practices
- Troubleshooting
🤝 Support
- Email: [email protected]
- Documentation: https://docs.offlinesync.techparse.fr
- Issues: https://github.com/Kromaric/offlinesync/issues
📄 License
This software is open source, released under the MIT License. See LICENSE for details.
🙏 Credits
Built with ❤️ for the NativePHP community.
📝 Changelog
See CHANGELOG.md for version history.
All versions of offline-sync with dependencies
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/database Version ^10.0|^11.0|^12.0
illuminate/http Version ^10.0|^11.0|^12.0