PHPackages                             dposkachei/laravel-db-snapshots-zip - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. dposkachei/laravel-db-snapshots-zip

ActiveLibrary[Database &amp; ORM](/categories/database)

dposkachei/laravel-db-snapshots-zip
===================================

Quickly dump and load databases

0.0.3(6y ago)07MITPHPPHP ^7.1

Since Aug 13Pushed 6y ago1 watchersCompare

[ Source](https://github.com/dposkachei/laravel-db-snapshots-zip)[ Packagist](https://packagist.org/packages/dposkachei/laravel-db-snapshots-zip)[ Docs](https://github.com/dposkachei/laravel-db-snapshots-zip)[ RSS](/packages/dposkachei-laravel-db-snapshots-zip/feed)WikiDiscussions master Synced yesterday

READMEChangelog (3)Dependencies (8)Versions (4)Used By (0)

Quickly dump and load databases
===============================

[](#quickly-dump-and-load-databases)

[![Latest Version on Packagist](https://camo.githubusercontent.com/1c1a48648768d7eab21faf6d4657107f40c6320b06851eeda91a22eaf9f933c9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7370617469652f6c61726176656c2d64622d736e617073686f74732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-db-snapshots)[![Quality Score](https://camo.githubusercontent.com/a7b720b519510ab33ad5a6b31566aab59e299520380771128ac6358700050288/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7370617469652f6c61726176656c2d64622d736e617073686f74732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/spatie/laravel-db-snapshots)[![StyleCI](https://camo.githubusercontent.com/d66e1d0d38bc39c580750406d9bcc53bdb711fb0be93a843d9714f50172e9fa4/68747470733a2f2f7374796c6563692e696f2f7265706f732f38353239353239382f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/85295298)[![Total Downloads](https://camo.githubusercontent.com/e22655ae12b960b1a09dd31195ceb4b09dda550e81b0ad16fb9b323b0501fb15/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370617469652f6c61726176656c2d64622d736e617073686f74732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-db-snapshots)

This package provides Artisan commands to quickly dump and load databases in a Laravel application.

```
# Create a dump
php artisan snapshot:create my-first-dump

# Make some changes to your db
# ...

# Create another dump
php artisan snapshot:create my-second-dump

# Load up the first dump
php artisan snapshot:load my-first-dump

# List all snapshots
php artisan snapshot:list
```

This package supports MySQL, PostgreSQL and SQLite.

Installation
------------

[](#installation)

You can install the package via Composer:

```
composer require spatie/laravel-db-snapshots
```

In Laravel 5.5 and above, the package will autoregister the service provider. For Laravel 5.4 or below you must install this service provider to `config/app.php`:

```
'providers' => [
    // ...
    Spatie\DbSnapshots\DbSnapshotsServiceProvider::class,
];
```

And finally you should add a disk named `snapshots` to `app/config/filesystems.php` on which the snapshots will be saved. This would be a typical configuration:

```
// ...
'disks' => [
    // ...
    'snapshots' => [
        'driver' => 'local',
        'root' => database_path('snapshots'),
    ],
// ...
```

Optionally, you may publish the configuration file with:

```
php artisan vendor:publish --provider="Spatie\DbSnapshots\DbSnapshotsServiceProvider" --tag="config"
```

This is the content of the published file:

```
return [

    /**
     * The name of the disk on which the snapshots are stored.
     */
    'disk' => 'snapshots',

    /**
     * The connection to be used to create snapshots. Set this to null
     * to use the default configured in `config/databases.php`
     */
    'default_connection' => null,

    /**
     * The directory where temporary files will be stored.
     */
    'temporary_directory_path' => storage_path('app/laravel-db-snapshots/temp'),

    /*
     * Create dump files that are gzipped
     */
    'compress' => false,
];
```

Usage
-----

[](#usage)

To create a snapshot (which is just a dump from the database) run:

```
php artisan snapshot:create my-first-dump
```

Giving your snapshot a name is optional. If you don't pass a name the current date time will be used:

```
# Creates a snapshot named something like `2017-03-17 14:31`
php artisan snapshot:create
```

When creating snapshots, you can optionally create compressed snapshots. To do this either pass the `--compress` option on the command line, or set the `db-snapshots.compress` configuration option to `true`:

```
# Creates a snapshot named my-compressed-dump.sql.gz
php artisan snapshot:create my-compressed-dump --compress
```

After you've made some changes to the database you can create another snapshot:

```
php artisan snapshot:create my-second-dump
```

To load a previous dump issue this command:

```
php artisan snapshot:load my-first-dump
```

To load a previous dump to another DB connection:

```
php artisan snapshot:load my-first-dump --connection=connectionName
```

To list all the dumps run:

```
php artisan snapshot:list
```

A dump can be deleted with:

```
php artisan snapshot:delete my-first-dump
```

Events
------

[](#events)

There are several events fired which can be used to perform some logic of your own:

- `Spatie\DbSnapshots\Events\CreatingSnapshot`: will be fired before a snapshot is created
- `Spatie\DbSnapshots\Events\CreatedSnapshot`: will be fired after a snapshot has been created
- `Spatie\DbSnapshots\Events\LoadingSnapshot`: will be fired before a snapshot is loaded
- `Spatie\DbSnapshots\Events\LoadedSnapshot`: will be fired after a snapshot has been loaded
- `Spatie\DbSnapshots\Events\DeletingSnapshot`: will be fired before a snapshot is deleted
- `Spatie\DbSnapshots\Events\DeletedSnapshot`: will be fired after a snapshot has been deleted

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Postcardware
------------

[](#postcardware)

You're free to use this package (it's [MIT-licensed](LICENSE.md)), but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.

Our address is: Spatie, Samberstraat 69D, 2060 Antwerp, Belgium.

We publish all received postcards [on our company website](https://spatie.be/en/opensource/postcards).

Credits
-------

[](#credits)

- [Freek Van der Herten](https://github.com/freekmurze)
- [All Contributors](../../contributors)

Support us
----------

[](#support-us)

Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects [on our website](https://spatie.be/opensource).

Does your business depend on our contributions? Reach out and support us on [Patreon](https://www.patreon.com/spatie). All pledges will be dedicated to allocating workforce on maintenance and new awesome stuff.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

2465d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b2d16feaa5d05c2118c6357acf47d632e2020c3e62ea252df9bf62fe6061ecc4?d=identicon)[dposkachei](/maintainers/dposkachei)

---

Top Contributors

[![dposkachei](https://avatars.githubusercontent.com/u/14970914?v=4)](https://github.com/dposkachei "dposkachei (6 commits)")

---

Tags

dposkacheilaravel-db-snapshots-zip

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dposkachei-laravel-db-snapshots-zip/health.svg)

```
[![Health](https://phpackages.com/badges/dposkachei-laravel-db-snapshots-zip/health.svg)](https://phpackages.com/packages/dposkachei-laravel-db-snapshots-zip)
```

###  Alternatives

[spatie/laravel-backup

A Laravel package to backup your application

6.0k21.8M191](/packages/spatie-laravel-backup)[spatie/laravel-db-snapshots

Quickly dump and load databases

1.2k2.8M20](/packages/spatie-laravel-db-snapshots)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[plank/laravel-mediable

A package for easily uploading and attaching media files to models with Laravel

8271.5M11](/packages/plank-laravel-mediable)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)[genealabs/laravel-pivot-events

This package introduces new eloquent events for sync(), attach(), detach() or updateExistingPivot() methods on BelongsToMany relation.

1404.9M8](/packages/genealabs-laravel-pivot-events)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
