backup-manager/laravel
| Install | |
|---|---|
composer require backup-manager/laravel |
|
| Latest Version: | 3.1.0 |
| PHP: | ^8.2 |
| Laravel: | 12 · 13 |
| Older releases: | 4 – 11 |
| License: | MIT |
| Last Updated: | Nov 22, 2026 |
| Links: | GitHub · Packagist |
Laravel Driver for the Database Backup Manager
Back up and restore your Laravel application's MySQL and PostgreSQL databases to S3, Google Cloud Storage, Dropbox, FTP, SFTP, WebDAV or local disk, from Artisan or from your own code.
This package integrates the framework-agnostic Backup Manager into Laravel. For the core library or the Symfony integration, see the core repository.
- Requirements
- Installation
- Configuration
- Artisan commands
- Using the Manager in code
- Scheduling backups
- Supported versions
- Upgrading
- Contributing
- License
Requirements
- PHP 8.2+
- Laravel 12 or 13. For Laravel 7–11 use version 2.x; every release of those lines has an unpatched security advisory.
- MySQL or MariaDB: the
mysqldumpandmysqlbinaries - PostgreSQL: the
pg_dumpandpsqlbinaries - Gzip compression: the
gzipandgunzipbinaries
Installation
composer require backup-manager/laravel
The service provider is registered by package discovery. Publish the storage configuration:
php artisan vendor:publish --provider="BackupManager\Laravel\BackupManagerServiceProvider"
Then install the Flysystem 3 adapter package for each storage type you use:
| Type | Package (Flysystem 3) |
|---|---|
Local |
included |
AwsS3 |
league/flysystem-aws-s3-v3 |
AsyncAwsS3 |
league/flysystem-async-aws-s3 |
Gcs |
league/flysystem-google-cloud-storage |
Dropbox |
spatie/flysystem-dropbox |
Ftp |
league/flysystem-ftp |
Sftp |
league/flysystem-sftp-v3 |
Webdav |
league/flysystem-webdav |
If a package is missing, the backup fails with an error naming the package to install. To add your own filesystem type, extend the binding in a service provider:
$this->app->extend(FilesystemProvider::class, fn ($provider) => tap($provider)->add(new MyFilesystem()));
Configuration
Storage connections live in config/backup-manager.php. Each entry has a type and that type's settings. S3-compatible services (DigitalOcean Spaces, MinIO, ...) use the AwsS3 type with an endpoint (and use_path_style_endpoint where the service needs it).
Databases come from Laravel's own config/database.php connections; mysql, mariadb and pgsql connections can be backed up. MySQL and MariaDB connections accept these extra keys, which Laravel ignores and the backup uses:
'mysql' => [
'driver' => 'mysql',
// ... Laravel's usual keys; url (DB_URL) and unix_socket are used when set ...
'singleTransaction' => true, // --single-transaction (InnoDB)
'ignoreTables' => ['sessions'], // --ignore-table for each
'onlyTables' => ['users', 'orders'], // dump only these tables
'ssl' => false, // --ssl
'columnStatistics' => false, // --column-statistics=0 (MySQL 8 mysqldump against older servers)
'extraParams' => '--max-allowed-packet=64M', // appended to mysqldump
],
extraParams defaults to the BACKUP_MANAGER_EXTRA_PARAMS environment variable for every connection that does not set it.
Configuration is read when a backup runs, so connections changed at runtime with config([...]) are used, for example a tenant database selected before calling db:backup.
Artisan commands
db:backup, db:restore and db:list prompt for any option you leave out. In a non-interactive run (the scheduler, --no-interaction) a missing option is an error instead.
php artisan db:backup --database=mysql --destination=s3 --destinationPath=project/backup --timestamp="Y-m-d_H-i-s" --compression=gzip
php artisan db:list --source=s3 --path=project
php artisan db:restore --source=s3 --sourcePath=project/backup2026-11-22_04-00-00.gz --database=mysql --compression=gzip
--timestamp is a date format appended to the destination path; the compressor adds its extension (.gz).
Using the Manager in code
BackupManager\Manager is resolved by the container:
use BackupManager\Filesystems\Destination;
use BackupManager\Manager;
public function backup(Manager $manager)
{
$manager->makeBackup()->run('mysql', [new Destination('s3', 'project/backup.sql')], 'gzip');
}
This package backs up databases only. To delete old backups, use your storage's lifecycle rules (for example S3 lifecycle expiration) or Laravel's Storage facade.
Scheduling backups
// routes/console.php (Laravel 11+) or the schedule() method of app/Console/Kernel.php
Schedule::command('db:backup --database=mysql --destination=s3 --destinationPath=' . app()->environment() . '/backup --timestamp="Y_m_d_H_i_s" --compression=gzip')
->twiceDaily(13, 21);
Supported versions
| Version | Laravel | PHP | Core library | Support |
|---|---|---|---|---|
| 3.x | 12, 13 | 8.2+ | 4.x | active |
| 2.x | 7–13 | 7.4+ | 3.x | security fixes until 2027-12-31 |
Upgrading
See UPGRADE.md.
Contributing
Run the tests with vendor/bin/phpunit; CI also runs PHPStan, Psalm and PHP-CS-Fixer (PSR-12). The MySQL backup-and-restore test runs when BACKUP_MANAGER_TEST_MYSQL_PASSWORD is set (root user, database backup_manager_test on 127.0.0.1 and the default socket); CI runs it on every Laravel version. Proposals for new features are welcome as issues.
Maintained by Shawn McCool and contributors.
License
MIT. See CHANGELOG.md for release notes.
Related Packages
Back up your Laravel database (PostgreSQL, MySQL, MariaDB) to a private S3-compa...
A lightweight, expressive, framework agnostic query builder for PHP.
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 3.1.0 | ^8.2 | ^12.71.0 || | MIT | |
| 3.0.0 | ^8.2 | ^12.71.0 || | MIT | |
| 2.2.0 | ^7.4 || | ^7.0 || | MIT | |
| 2.1.0 | ^7.4 || | ^7.0 || | MIT | |
| 2.0 | ^7.3|| | ^5.5|| | MIT | |
| 1.4.0 | >=5.5.0 | ^4.0|| | MIT | |
| 1.3.1 | >=5.5.0 | ^4.0|| | MIT | |
| 1.3.0 | >=5.5.0 | ^4.0|| | MIT | |
| 1.2.2 | >=5.5.0 | ^4.0|| | MIT | |
| 1.2.1 | >=5.5.0 | ^4.0|| | MIT | |
| 1.2.0 | >=5.5.0 | ^4.0|| | MIT | |
| 1.1.2 | >=5.5.0 | ^4.0|| | MIT | |
| 1.1.1 | >=5.5.0 | ^4.0|| | MIT | |
| 1.1.0 | >=5.5.0 | ^4.0|| | MIT | |
| 1.0.3 | >=5.5.0 | ^4.0|| | MIT | |
| 1.0.2 | ^5.5.0 | ^4.0|| | MIT | |
| 1.0.1 | ^5.5.0 | ^4.0|| | MIT | |
| 1.0.0 | ^5.5.0 | ^4.0|| | MIT | |
| 0.2.9 | ^5.5.0 | ^4.0|| | MIT | |
| 0.2.8 | ^5.5.0 | ^4.0|| | MIT | |
| 0.2.7 | ^5.5.0 | ^4.0|| | MIT | |
| 0.2.6 | ^5.5.0 | ^4.0|| | MIT | |
| 0.2.5 | ^5.5.0 | ^4.0|| | MIT | |
| 0.2.4 | ^5.5.0 | ^4.0|| | MIT | |
| 0.2.3 | ^5.5.0 | ^4.0|| | MIT | |
| 0.2.2 | ^5.5.0 | ^4.0|| | MIT | |
| 0.2.1 | ^5.5.0 | ^4.0|| | MIT | |
| 0.2.0 | >=5.4.0 | 4.x | MIT | |
| 0.1.2 | >=5.4.0 | 4.x | MIT | |
| 0.1.1 | >=5.4.0 | 4.x | MIT |
Showing the latest 30 of 33. See every release on Packagist