ciiixid / laravel-db-timetravel
A local database time-travel snapshot CLI tool for Laravel developers
Requires
- php: ^8.2
- illuminate/console: ^10.0|^11.0|^12.0|^13.0
- illuminate/support: ^10.0|^11.0|^12.0|^13.0
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
A lightweight Laravel package for database time-travel and Git-style workflows. Easily create snapshots, view timelines, and manage database branches and checkouts for MySQL and SQLite.
Requirements
- PHP:
^8.2 - Laravel:
^10.0or^11.0 - Database: MySQL (requires
mysqldump&mysqlbinaries) or SQLite
Installation
Install the package via Composer:
composer require nitefine/laravel-db-timetravel
Publish the configuration file (optional):
php artisan vendor:publish --tag=timetravel-config
Usage
1. Create a Snapshot
Save the current state of your database:
php artisan db:snap [snapshot-name]
2. View Timeline
List all available snapshots chronologically in a neat table:
php artisan db:timeline
3. Restore / Travel Back
Restore your database to a specific snapshot interactively:
php artisan db:travel
4. Git-Style Branching
Create a new database branch to test experimental features safely:
php artisan db:branch [branch-name] -m "Description of the branch"
5. Checkout Branch
Switch and restore your database to the latest snapshot of a specific branch:
php artisan db:checkout [branch-name]
Testing
Run tests locally during your development process:
vendor/bin/pest
License
The MIT License (MIT). Please see the LICENSE file for more information.