PHPackages                             tomshaw/laravel-database-export - 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. tomshaw/laravel-database-export

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

tomshaw/laravel-database-export
===============================

A Laravel database export console command.

v0.6.1(3w ago)1609[1 PRs](https://github.com/tomshaw/laravel-database-export/pulls)MITPHPPHP ^8.5CI passing

Since Nov 11Pushed 2w ago1 watchersCompare

[ Source](https://github.com/tomshaw/laravel-database-export)[ Packagist](https://packagist.org/packages/tomshaw/laravel-database-export)[ RSS](/packages/tomshaw-laravel-database-export/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (7)Dependencies (17)Versions (16)Used By (0)

Laravel Database Export 💾
=========================

[](#laravel-database-export-)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9bb82ff435b7349e6e1b6cf5d97908635d0b10c5e44ca39d3de2ed81e7832b80/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f6d736861772f6c61726176656c2d64617461626173652d6578706f72743f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tomshaw/laravel-database-export)[![Total Downloads](https://camo.githubusercontent.com/64d4b3f2638d57c1c11fc8caa25b94eafa31d9aff1ceeeba18edaa3152bd6191/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f6d736861772f6c61726176656c2d64617461626173652d6578706f72743f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tomshaw/laravel-database-export)[![Tests](https://camo.githubusercontent.com/ff833c1fa7369937d6bf9a1ee85ef1ae59e5bf114caa3efe081731ad8a8b243c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f746f6d736861772f6c61726176656c2d64617461626173652d6578706f72742f72756e2d74657374732e796d6c3f6272616e63683d6d6173746572267374796c653d666c61742d737175617265266c6162656c3d7465737473)](https://github.com/tomshaw/laravel-database-export/actions/workflows/run-tests.yml)[![License](https://camo.githubusercontent.com/cb80326133a4470e9ad8ec887c026cd30269ffa071092a4951d1489ed41994ae/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f746f6d736861772f6c61726176656c2d64617461626173652d6578706f72743f7374796c653d666c61742d737175617265)](https://github.com/tomshaw/laravel-database-export/blob/master/LICENSE)

A Laravel console command that exports your database to a compressed, optionally AES-256 encrypted zip archive on any Laravel filesystem disk. Supports SQLite, MySQL, MariaDB, PostgreSQL and SQL Server.

Features
--------

[](#features)

- **Streams to disk** — dumps are written directly to a temporary file by the native dump tool, so large databases never exhaust PHP's memory.
- **Credentials stay off the command line** — passwords are passed via `MYSQL_PWD`, `PGPASSWORD` and `SQLCMDPASSWORD` environment variables so they never appear in the process list.
- **Any filesystem disk** — archives are uploaded via streams, so remote disks such as Amazon S3 or SFTP work out of the box.
- **AES-256 zip encryption** — archives are encrypted with the database password, or a password you provide.
- **Driver aware** — connections are resolved by driver, so custom-named connections work, and each driver's dump options are configurable.

Requirements
------------

[](#requirements)

- PHP 8.5
- Laravel 13.0
- The PHP `zip` extension and the dump tool for your database (`sqlite3`, `mysqldump`, `pg_dump` or `sqlcmd`) on your `PATH`.

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

[](#installation)

You can install the package via composer:

```
composer require tomshaw/laravel-database-export
```

Optionally publish the configuration file:

```
php artisan vendor:publish --tag=database-export-config
```

Usage
-----

[](#usage)

Export the default database connection:

```
php artisan db:export
```

Export a specific connection:

```
php artisan db:export --connection=pgsql
```

Encrypt the archive with a custom password (defaults to the database password when omitted):

```
php artisan db:export --password=yourpassword
```

Archives are stored as `exports/{connection}/{filename}-{timestamp}.zip` on the configured disk.

### Scheduling

[](#scheduling)

The command implements `Isolatable`, so overlapping scheduled runs are prevented automatically:

```
Schedule::command('db:export', ['--isolated' => true])->daily();
```

Configuration
-------------

[](#configuration)

KeyEnv variableDefaultDescription`database-export.disk``BACKUP_DISK``local`Filesystem disk where archives are stored.`database-export.filename``BACKUP_FILENAME``export`Base filename; a timestamp is appended.`database-export.directory``BACKUP_DIRECTORY``exports`Directory on the disk; a per-connection subdirectory is added.`database-export.timeout``BACKUP_TIMEOUT``3600`Maximum seconds the dump process may run.`database-export.compression_level``BACKUP_COMPRESSION_LEVEL``6`Deflate compression level (0–9).`database-export.options`—sensible defaultsExtra CLI options passed to the dump tool, per driver.For example, the default MySQL options produce consistent, complete dumps without table locks:

```
'options' => [
    'mysql' => ['--single-transaction', '--routines', '--triggers', '--no-tablespaces'],
],
```

Notes
-----

[](#notes)

- SQLite connections have no database password, so their archives are only encrypted when `--password` is provided.
- SQL Server backups use `BACKUP DATABASE`, which is executed by the database server itself — the server must have access to the local temporary directory, so this is intended for setups where the server runs on the same host.

Testing
-------

[](#testing)

```
composer test
```

Run static analysis and formatting:

```
composer analyse
composer format
```

Support
-------

[](#support)

If you have any issues or questions, please open an issue on the GitHub repository.

Changelog
---------

[](#changelog)

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

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

[](#contributing)

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

License
-------

[](#license)

The MIT License (MIT). See [License File](LICENSE) for more information.

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance96

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90% 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 ~141 days

Recently: every ~28 days

Total

8

Last Release

22d ago

PHP version history (3 changes)v0.1.0PHP ^8.1

v0.2.0PHP ^8.3|^8.4|^8.5

v0.3.0PHP ^8.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/14fd02efdbaf6247b61c9846697c86dabcbf430374aeff0d80e509d95d186658?d=identicon)[Tom Shaw](/maintainers/Tom%20Shaw)

---

Top Contributors

[![tomshaw](https://avatars.githubusercontent.com/u/32818?v=4)](https://github.com/tomshaw "tomshaw (54 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (6 commits)")

---

Tags

consolelaraveldatabaseartisanexporter

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tomshaw-laravel-database-export/health.svg)

```
[![Health](https://phpackages.com/badges/tomshaw-laravel-database-export/health.svg)](https://phpackages.com/packages/tomshaw-laravel-database-export)
```

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11225.5M36](/packages/anourvalar-eloquent-serialize)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

137236.2k8](/packages/statamic-rad-pack-runway)[ramadan/custom-fresh

A Laravel package to specify the tables that you do not want to drop while refreshing the database.

613.1k](/packages/ramadan-custom-fresh)[boaideas/laravel-cli-create-user

An artisan command to create, list and remove users in a laravel application from the cli

1710.8k](/packages/boaideas-laravel-cli-create-user)[ramadan/easy-model

A Laravel package for enjoyably managing database queries.

111.6k](/packages/ramadan-easy-model)

PHPackages © 2026

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