Download the PHP package lily-labs/db-backup without Composer
On this page you can find all versions of the php package lily-labs/db-backup. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download lily-labs/db-backup
More information about lily-labs/db-backup
Files in lily-labs/db-backup
Package db-backup
Short Description DBBackup it's a library that provides classes to execute mysqldump to backup the given database, relocate the backup file in the local filesystem and compress the resulting backup file.
License MIT
Homepage https://github.com/spatie/DBBackup
Informations about the package db-backup
DBBackup it's a library that provides classes to execute mysqldump to backup the given database, relocate the backup file in the local filesystem and compress the resulting backup file.
Requirements
- PHP 7.1+
- MySQL client/server version 5.6.x
- Gzip on the server (only tested on unix)
Installation
You can install the package via composer:
For the backup process to work, it requires that you pre-configure a local login for mysql on your server using mysql_config_editor
as follows:
Your database password will be asked after entering the command.
You can se more information here
Usage
First create a BackupFileNameGenerator
, this will generate the desire filename for the backup file, the default implementation LilyLabs\DBBackup\BasicBackupFileNameGenerator
will generate a file name in this format: "[database_name]_[year]-[month]-[day].sql"
Now, create an instance of LilyLabs\DBBackup\MysqldumpBackupProcessor
to execute the backup process
The returned object is an instance of LilyLabs\DBBackup\DBBackupFile
, all backups are generated on the temp folder obtained by sys_get_temp_dir()
, you can now move the file to your desired storage location.
Finally, you can use the class LilyLabs\DBBackup\GzipCompressor
to gzip the backupfile:
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Abraham Chávez
- All Contributors
License
The MIT License (MIT). Please see License File for more information.