- How do I install salvatorecervone/backup-database in a Laravel application?
- Install it with Composer by requiring salvatorecervone/backup-database, then publish the package configuration if the service provider does not auto-discover it. After publishing, review the config for your database connection and target storage disk. No manual service provider registration is needed on modern Laravel versions with package discovery.
- Which Laravel and PHP versions does this database backup package support?
- The package is built for modern Laravel releases and follows standard Composer version constraints. Because exact Laravel and PHP requirements can change between releases, check the require section in the package composer.json on Packagist or GitHub before installing. Confirm the constraint matches your application's framework version to avoid dependency conflicts.
- How do I configure where the database backups are stored?
- Backups are written through Laravel's filesystem layer, so you point the package at any disk defined in config/filesystems.php. Set the disk name in the package configuration, and it will use the Storage facade to write the dump file. This lets you store backups locally, on S3, or on any other configured Laravel disk without changing code.
- How do I run a database backup from the command line?
- The package exposes Artisan commands, so you can trigger an on-demand backup with a single php artisan call from your terminal or deployment script. Run it manually during development to confirm the connection and disk are configured correctly. The same command can be wrapped in cron or the Laravel scheduler for automation.
- Can I schedule automatic database backups in Laravel?
- Yes. Because backups run through an Artisan command, you can register it in the Laravel scheduler using the console kernel or the routes/console.php schedule API. A typical setup runs a daily backup during low-traffic hours and uses withoutOverlapping to prevent concurrent dumps. Make sure the scheduler cron entry is active on the server.
- Which database drivers does this Laravel backup package support?
- It is designed to work with common Laravel database connections rather than a single vendor. In practice this covers the drivers most applications use, such as MySQL, PostgreSQL, and SQLite, using the connection details already defined in config/database.php. Verify your specific driver and server version on a staging environment before relying on it in production.
- Where are the backup files stored by default?
- By default the dump is written to the filesystem disk named in the package configuration, which is typically the local disk under storage/app. You can change the disk and path to keep backups outside the application directory or on remote object storage. Keeping backups on a separate volume from the database server is recommended for disaster recovery.
- Does the package support restoring a database from a backup?
- The package focuses on creating and managing database backups rather than full restore automation. Restoring is usually done with the native database client, such as mysql or psql, by importing the generated dump file. Test your restore procedure regularly so you know the backups are usable when you actually need them.
- Is salvatorecervone/backup-database safe to use in production?
- It is a lightweight wrapper around Laravel's Artisan and filesystem layers, so the main risks are configuration related: wrong connection details, disk permissions, or credentials with insufficient access. Run a backup on staging first, verify the dump file is complete and restorable, and monitor disk space. Store credentials in environment variables and never commit backup archives to version control.
- What are the alternatives to this Laravel database backup package?
- The best-known alternative is spatie/laravel-backup, which adds cleaning, notifications, and multi-destination support for larger projects. Simpler options include backup-manager style packages or calling mysqldump directly from a scheduled command. salvatorecervone/backup-database is a good fit when you want minimal configuration and a small dependency footprint.