avocet-shores/laravel-rewind
Full version control for Eloquent models: rewind, fast-forward, restore, diff, and query point-in-time state. Uses a hybrid engine (diffs + snapshots) with configurable intervals, thread-safe locking, batch revisions, queued writes, and pruning.
Rewindable trait integrates seamlessly with existing models, avoiding invasive modifications to core logic.restored, deleted) and metadata, enabling tailored workflows (e.g., triggering notifications on state transitions).Rewindable trait to target models.current_version column).rewind_versions table and a column per tracked model. Minimal schema changes if using the default configuration.on_lock_timeout: 'throw') could block writes. Mitigate via queue retries or event-based handling.listener_should_queue: true and monitor RewindVersionLockTimeout events.max_versions per model or prune:keep).config/rewind.php and schedule pruning (e.g., daily via Laravel Scheduler).$rewindStateFields) add query flexibility but require explicit definition. Overuse may complicate diffs.snapshot_interval: 50) may slow down goTo() or diff() for older versions.Order, UserProfile) and exclude low-impact ones (e.g., Setting).status changes) critical for compliance? If so, define $rewindStateFields explicitly.rewind()/diff()? Test with snapshot_interval tuned to your workload.prune_older_than_days and max_versions conservatively.listener_should_queue: true) and monitor lock timeouts.initVersion() to backfill v1 or accept manual initialization.RewindVersion model suffice, or are extensions (e.g., soft deletes) required?current_version column (integer) and rewind_versions table (supports indexes for model_type, model_id, version).Order, Invoice).password).composer require avocet-shores/laravel-rewind.php artisan vendor:publish --provider="AvocetShores\LaravelRewind\LaravelRewindServiceProvider".php artisan migrate.use Rewindable; to target models.$rewindStateFields (if needed) and excludedFromVersioning().php artisan rewind:add-version or manually call initVersion().config/rewind.php:
snapshot_interval: Balance storage vs. reconstruction speed.max_versions: Per-model limits.prune_keep_versions: Retention policy.listener_should_queue: Enable for high-write models.Rewind::rewind($model), Rewind::diff($model, v1, v2).php artisan rewind:prune --pretend).php artisan rewind:prune --keep=100 --days=365 daily).$model->update()) trigger versioning automatically.saving/updating events. Use Rewind::amendCurrentVersion() for counter/denormalized fields.v1 manually or via initVersion().current_version column is nullable (default) to avoid migration errors.rewind_versions table and current_version column if needed.amendCurrentVersion() to bypass versioning temporarily during debugging.config/rewind.php. Use Laravel’s config caching (php artisan config:cache) in production.rewind_versions table and current_version column. Use migrations for future updates.RewindVersion::forModel($model)->get() to inspect history.on_lock_timeout: 'event' to catch concurrency issues.Rewindable trait is added and current_version column exists.snapshot_interval or optimize queries on rewind_versions.failed_jobs table and adjust queue workers.$rewindStateFields and excluded attributes.How can I help you explore Laravel packages today?