Download the PHP package salvatorecervone/backup-database without Composer
On this page you can find all versions of the php package salvatorecervone/backup-database. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download salvatorecervone/backup-database
More information about salvatorecervone/backup-database
Files in salvatorecervone/backup-database
Package backup-database
Short Description This package manage backup-database
License MIT
Homepage https://github.com/SalvatoreCervone/backup-database
Informations about the package backup-database
LARAVEL BACKUP-DATABASE
A powerful and flexible Laravel package to manage your database backups and restorations. The missing MSSQL (SQL Server) backup solution for Laravel — also supports MySQL, with the ability to save backups to local or remote shares via SMB.
Why this package? Popular backup packages like
spatie/laravel-backupdo not support Microsoft SQL Server. If you work with MSSQL in a Laravel environment, this is the package for you.
Key Features
- [x] First-Class MSSQL Support: Full backup and restore via
sqlcmd, withSINGLE_USERmode for safe restores. - [x] Multi-Database Support: Backup one or more databases in a single operation.
- [x] Driver Pattern: Native support for MSSQL and MySQL.
- [x] Database Restoration: Restore your databases directly from the dashboard or via code.
- [x] SMB Integration: Save and manage backups on SMB shares (via
smbclient). - [x] MSSQL Compression: Optional native
WITH COMPRESSIONfor smaller backup files. - [x] Backup Verification: Verify backup integrity with
RESTORE VERIFYONLY(MSSQL). - [x] Automatic Cleanup: Backup rotation with "Soft Delete" support (moving to a trash folder).
- [x] Email Notifications: Receive automatic email alerts when a backup fails.
- [x] Activity Logging: Daily log files to track every operation (backup, restore, delete).
- [x] Modern Dashboard: Web interface to monitor, create, restore backups, and view logs.
- [x] Security: Configurable middleware, authorization gates, and path traversal protection.
Installation
You can install the package via composer:
Next, publish the configuration file:
Configuration
The configuration file is located at config/backup-database.php.
Route Protection (Middleware)
By default, the dashboard and all backup routes are protected by web and auth middleware. You can customize this:
Connections
You can configure multiple connections:
Binary Paths
If the required tools are not in your system PATH, you can specify their locations:
Email Notifications
Set an email address to receive alerts on backup failure. Ensure your Laravel SMTP settings are configured in your app's .env.
Logging
By default, the package logs all activities to storage/logs/backup-database-YYYY-MM-DD.log. You can toggle this feature:
Usage
Web Dashboard
Access the dashboard by navigating to:
http://your-app.test/backups
From the dashboard you can:
- View all existing backups.
- Manually run backups for all connections.
- Restore a database from a specific file.
- Delete old backups.
Artisan Command
To automate backups (e.g., via Laravel's scheduler):
The command returns a non-zero exit code if any backup fails, making it suitable for monitoring tools.
Scheduling
Add the command to your routes/console.php (or Kernel.php for older Laravel versions):
Programmatic Usage
You can also use the service directly in your code:
Important Notes for MSSQL Users
How MSSQL Backup Works
The BACKUP DATABASE ... TO DISK command is executed by the SQL Server engine, not by PHP. This means:
- The destination path must be accessible to the SQL Server service account (e.g.,
NT SERVICE\MSSQLSERVERon Windows, ormssqlon Linux). - If Laravel and SQL Server are on different machines, the destination path must be a network share (UNC path) that SQL Server can write to (e.g.,
\\192.168.1.100\backups\). - If they are on the same machine, a local path works fine.
MSSQL Compression
Enable native backup compression by adding 'compression' => true to your connection config. This uses SQL Server's WITH COMPRESSION option, which can reduce backup sizes by 50-80%.
System Requirements
- PHP 8.3 or higher
- Laravel 10.x, 11.x, or 12.x
- MSSQL:
sqlcmdinstalled on the server. - MySQL:
mysqldumpandmysqlclient installed. - SMB:
smbclientinstalled (required for SMB shares on Linux).
Credits
License
MIT License. Please see the LICENSE file for more information.
All versions of backup-database with dependencies
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^10.0||^11.0||^12.0
