sagar-s-bhedodkar/laravel-dev-snapshot

Dev environment snapshot and restore for Laravel (DB + storage + config + env)

Installs: 4

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/sagar-s-bhedodkar/laravel-dev-snapshot

v1.0.3 2025-10-12 17:54 UTC

This package is auto-updated.

Last update: 2025-10-12 17:55:01 UTC


README

Automate Laravel development environment snapshots and restores โ€” database, storage, and environment configuration โ€” all in one command.

License: MIT Laravel Packagist GitHub stars

๐Ÿ“˜ Table of Contents

๐Ÿš€ Introduction

Laravel Dev Snapshot is a lightweight package that helps developers manage their local environment snapshots easily.

Instead of manually exporting your database, copying .env, or saving config files โ€” do it all with a single command:

php artisan dev:snapshot
php artisan dev:restore snapshot_name

This helps reset your local environment safely, reproduce bugs, or sync data across developers in seconds.

โœจ Features

  • ๐Ÿ“ฆ Create and restore full development snapshots
  • ๐Ÿง  Includes database, storage, .env, and configuration files
  • โš™๏ธ Works only in local or testing environments (for safety)
  • ๐Ÿชถ Simple Artisan commands (dev:snapshot, dev:restore)
  • ๐Ÿ’พ Optional compression to ZIP files
  • ๐Ÿงน Clean and easy rollback system

โš™๏ธ Installation

Require the package via Composer:

composer require sagar-s-bhedodkar/laravel-dev-snapshot --dev

๐Ÿ”ง Configuration

Publish the configuration file:

php artisan vendor:publish --provider="SagarSBhedodkar\LaravelDevSnapshot\Providers\DevSnapshotServiceProvider" --tag=config

The configuration will appear at config/dev-snapshot.php:

return [
    'snapshot_path' => env('DEV_SNAPSHOT_PATH', 'snapshots'),
    'include_storage_paths' => ['storage/app/public'],
    'include_env' => true,
    'include_config_paths' => ['config/app.php'],
    'exclude_tables' => [],
    'compress' => true,
    'allowed_environments' => ['local', 'testing'],
];

๐Ÿง  Usage

โž• Create a snapshot

php artisan dev:snapshot

Optionally name your snapshot:

php artisan dev:snapshot --name=my-local-backup

โ™ป๏ธ Restore a snapshot

php artisan dev:restore snapshot-20251012-abc123

๐Ÿงฉ Example Workflow

  1. You make large DB or storage changes.
  2. Run:
    php artisan dev:snapshot --name=pre-test
  3. After testing, restore the environment:
    php artisan dev:restore pre-test
  4. Your DB, env, and storage are restored to that state instantly.

๐Ÿ›ก๏ธ Safety

Snapshots and restores will only run in local or testing environments.

The package will refuse to execute in production to avoid data loss.

๐Ÿค Contributing

Contributions are welcome!

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/new-feature
  3. Commit your changes: git commit -m "Add new feature"
  4. Push to your fork: git push origin feature/new-feature
  5. Submit a Pull Request ๐ŸŽ‰

๐Ÿ“„ License

This package is open-sourced software licensed under the MIT license.

๐Ÿ‘จโ€๐Ÿ’ป Author

Sagar Sunil Bhedodkar
๐Ÿ“ง sagarbhedodkar456@gmail.com
๐ŸŒ GitHub Profile

Made with โค๏ธ for Laravel developers who value automation, safety, and simplicity.