cboxdk / laravel-sync
Offline-first sync engine for Laravel: durable storage, field-level conflicts and contextual client views
Requires
- php: ^8.4
- ext-pdo: *
- cboxdk/sync: ^0.3
- illuminate/config: ^12.0 || ^13.0
- illuminate/contracts: ^12.0 || ^13.0
- illuminate/database: ^12.0 || ^13.0
- illuminate/support: ^12.0 || ^13.0
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.32
- orchestra/testbench: ^10.0 || ^11.0
- pestphp/pest: ^3.5 || ^4.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Offline-first sync for Laravel applications: one authoritative server, many replicas, field-level conflicts that are preserved rather than silently overwritten.
This package is the Laravel integration. The engine and its durable storage live
in cboxdk/sync, which has no framework
dependency; this one wires it into the container, uses one of the application's
own database connections, and delegates transaction control to Laravel so it
composes with DB::transaction().
composer require cboxdk/laravel-sync php artisan migrate
use Cbox\Sync\Data\FieldOperation; use Cbox\Sync\Data\Mutation; use Cbox\Sync\Engine; $result = app(Engine::class)->process(new Mutation( id: $clientMutationId, entity: new EntityKey('tenant-1', 'notes', $noteId), replica: new Replica($deviceId), sequence: new MutationSequence($clientSequence), kind: MutationKind::Update, baseVersion: new RecordVersion($knownVersion), operations: [FieldOperation::set('title', $title)], ));
Start with the quickstart. See installation, testing and configuration.
Requires PHP ^8.4 and Laravel 12 or 13. Requirements
are generated from Composer metadata.
The HTTP endpoints ship with the package but are off by default: your application owns authentication and decides how a space is resolved from a request. It ships no UI. A space accepts one concurrent writer by design — it is the ordering boundary — so pick spaces that match your tenancy.
MIT, copyright Cbox. See LICENSE and BUILD-STATUS.md.