2017 © Pedro Peláez
 

library dbbackup

Create backup files of databases or individual tables and restore from dump files

image

hgg/dbbackup

Create backup files of databases or individual tables and restore from dump files

  • Friday, November 7, 2014
  • by hglattergotz
  • Repository
  • 2 Watchers
  • 4 Stars
  • 29 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

No longer maintained! Please use http://github.com/hglattergotz/dbcmd instead, (*1)

Programmatically create dump files of an entire database or individual tables in a PHP application. Restore from dump files., (*2)

Build Status, (*3)

Installation

Using Composer:, (*4)

{
    "require": {
        "hgg/dbbackup": "dev-master"
    }
}

Download source and manually add to project:, (*5)

  • Get the zip file here

Supported Databases:

  • MySql

Pull Requests for additional database engines welcome!, (*6)

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
}

The Versions

07/11 2014

dev-master

9999999-dev http://github.com/hglattergotz/dbbackup

Create backup files of databases or individual tables and restore from dump files

  Sources   Download

MIT

The Requires

 

mysql backup dump