- How do I track sync status for Eloquent models in Laravel using this package?
- Use the `Syncable` trait on your Eloquent models and emit `Syncing` events in your business logic (e.g., `OrderService::syncToThirdParty()`). The package automatically records timestamps, statuses, and metadata in Redis for each sync operation.
- Does Laravel Sync Tracker support syncing non-Eloquent data (e.g., raw API payloads or MongoDB collections)?
- The package is optimized for Eloquent models, but you can extend it by creating custom sync strategies or event emitters. For non-Eloquent data, you’ll need to manually trigger sync events and handle metadata storage in Redis or a fallback database.
- What Laravel versions are officially supported by this package?
- Laravel Sync Tracker is tested and compatible with Laravel 9.x, 10.x, and 12.x. Always check the package’s `composer.json` for the latest version support, as Laravel 13+ may introduce breaking changes.
- How does the package handle failed syncs or retries?
- The package includes built-in retry logic via `SyncStrategy`, but for production-grade reliability, integrate it with Laravel Queues (e.g., Redis or database queues) or external services like SQS. Customize retry delays and dead-letter queues as needed.
- Can I use Laravel Sync Tracker for real-time syncs (e.g., WebSocket updates or event-driven APIs)?
- While the package supports event-driven syncs, it relies on Redis for state management, which introduces latency. For real-time use cases, consider batching events or using a lighter-weight in-memory cache like APCu for critical paths.
- What happens if Redis goes down? Will sync tracking still work?
- Redis outages will disrupt sync tracking. Mitigate this by implementing a fallback storage (e.g., database) for critical systems or using local caching during Redis downtime. Monitor Redis health with tools like `redis-memory-usage` to avoid memory issues.
- How do I monitor sync failures or track sync performance in production?
- The package lacks built-in observability, but you can integrate it with Laravel Horizon for job monitoring or add custom metrics (e.g., `sync_duration_seconds`) using Prometheus. For audit logs, extend the package to log sync events to a database or SIEM tool.
- Is there a way to sync data between Laravel and non-Laravel systems (e.g., Python services or Kafka)?
- The package is Laravel-centric and relies on Eloquent events, but you can emit sync events from non-Laravel systems by calling a Laravel HTTP endpoint or queue job. For Kafka, use a consumer to trigger Laravel events or sync strategies.
- What are the alternatives to Laravel Sync Tracker for tracking sync status?
- Consider `spatie/laravel-activitylog` for audit trails, `laravel-queue` with custom job tracking, or `octobercms/rain` for CMS-specific syncs. For Redis-based event sourcing, explore `laravel-ide-helper` or custom solutions using `predis` directly.
- How do I test sync tracking in a CI/CD pipeline or staging environment?
- Write integration tests using Laravel’s testing tools to verify sync events, status updates, and Redis storage. Mock Redis in tests with `Mockery` or use a local Redis instance. Test edge cases like concurrent syncs, retries, and failures to ensure robustness.