avocet-shores/laravel-rewind
Full version control for Eloquent models: rewind, fast-forward, restore, diff, and query point-in-time state. Uses hybrid diffs + snapshots for efficient storage and fast reconstruction, with locking for safe concurrent writes, batching, queues, and pruning.
rewindStateFields reduces boilerplate for tracking critical transitions (e.g., status, payment_status), which is valuable for domain-driven applications.current_version column to tracked models and a versions table for storing history. This is non-intrusive but requires migration planning.listener_should_queue), which is critical for high-traffic applications to avoid blocking user requests. This integrates seamlessly with Laravel’s queue system (e.g., Redis, database queues).RewindVersion model, custom metadata, and event hooks, allowing for tailored behavior (e.g., adding soft-deletes, custom scopes, or notifications).amendCurrentVersion for non-critical updates or disable versioning for high-volume models.snapshot_interval config helps balance this, but testing with production-like data volumes is essential.on_lock_timeout) could lead to race conditions or lost updates. Defaults to logging, but production systems may need to throw exceptions or use events for custom handling.rewind:prune) is robust but requires proactive management (e.g., scheduled jobs, monitoring). Misconfiguration (e.g., keep=0) could lead to data loss.rewindStateFields would add significant value?amendCurrentVersion may be critical.snapshot_interval or pruning policies.RewindVersion model need extensions (e.g., soft deletes, additional columns)?initVersion() method can seed initial versions, but backfilling large datasets may require custom scripts.RewindVersionLockTimeout events or custom event listeners.password, api_token).keep=100, days=365) and test with staging data.composer require avocet-shores/laravel-rewind
php artisan vendor:publish --provider="AvocetShores\LaravelRewind\LaravelRewindServiceProvider"
php artisan migrate
Rewindable trait to target models and define excludedFromVersioning/rewindStateFields as needed.versions table growth).diff() or goTo() operations).initVersion() to seed initial versions for existing records. For large datasets, consider a custom script to batch-insert versions.--keep=100 --pretend for dry runs).snapshot_interval or pruning policies as needed.Illuminate\Database\Eloquent\Model.created_at and updated_at timestamp column (standard for Eloquent).updated_at timestamps or use the current_version column.versions table size, query times).snapshot_interval or queue settings as needed.Rewind API for developers (e.g., goTo(), diff(), restore()).rewind:prune command is automated but should be monitored (e.g., via Laravel Horizon or external monitoring).config/rewind.php (e.g., prune_keep_versions, prune_older_than_days) to align with retention policies.RewindVersion) may require manual intervention. Monitor the changelog for breaking changes.AvocetShores\LaravelRewind to troubleshoot issues (e.g., lock timeouts, version creation failures).Rewind API and its implications (e.gHow can I help you explore Laravel packages today?