hgg / dbbackup
Create backup files of databases or individual tables and restore from dump files
dev-master
2014-11-07 11:32 UTC
Requires
- php: >=5.3.3
- symfony/process: >=2.1.0
This package is not auto-updated.
Last update: 2024-11-18 17:02:09 UTC
README
No longer maintained! Please use http://github.com/hglattergotz/dbcmd instead
Programmatically create dump files of an entire database or individual tables in a PHP application. Restore from dump files.
Installation
Using Composer:
{ "require": { "hgg/dbbackup": "dev-master" } }
Download source and manually add to project:
- Get the zip file here
Supported Databases:
- MySql
Pull Requests for additional database engines welcome!
Usage
Backup entire database
use HGG\DbBackup\CmdBuilder\MySql; use HGG\DbBackup\DbBackup; try { $output = ''; $backup = new DbBackup(new MySql()); $backup->backupDb('username', 'password', 'localhost', 'database', 'backupFile', array(), &$output); // log $output } catch (\Exception $e) { // deal with failure }
Backup specific tables in a database
use HGG\DbBackup\CmdBuilder\MySql; use HGG\DbBackup\DbBackup; try { $output = ''; $backup = new DbBackup(new MySql()); $backup->backupTables('username', 'password', 'localhost', 'database', array('table1', 'table2'), 'backupFile', array(), &$output); // log $output } catch (\Exception $e) { // deal with failure }
Restore form a dump file
use HGG\DbBackup\CmdBuilder\MySql; use HGG\DbBackup\DbRestore; try { $output = ''; $restore = new DbRestore(new MySql()); $restore->restore('username', 'password', 'localhost', 'database', 'backupFile', array(), &$output); // log $output } catch (\Exception $e) { // deal with failure }