PHP Classes

Maratus PHP Backup Databases: Backup many types of database to multiple storages

Recommend this page to a friend!
  Info   View files Example   View files View files (16)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-01-10 (3 days ago) RSS 2.0 feedStarStarStarStar 64%Total: 420 This week: 5All time: 6,381 This week: 71Up
Version License PHP version Categories
maratus-php-backup 1.0.9MIT/X Consortium ...5.5PHP 5, Databases, Systems administration, W...
Description 

Author

This package can backup many types of database to multiple storages.

It can access several type of databases and retrieve the stored data to perform a backup to several types of storage containers.

Currently it can take backups of MySQL, PostgreSQL, CouchDB, MongoDB, Redis, Riak and SQLite.

The backup data can be stored as a local file or sent to Google Drive, Dropbox, Copy or an FTP server.

Innovation Award
PHP Programming Innovation award nominee
April 2015
Number 6


Prize: One year server license IP to country, region, city, latitude, longitude, ZIP code, time zone, area code database
Backup is an important process that many sites need to have in place, just in case something bad happens.

Great part of the backup solutions are focused on MySQL. This package provides a more generalized backup solution that can also take backups of SQL and noSQL databases.

The backup data can be sent to several types of remote servers and cloud storage services.

Manuel Lemos
Picture of Jasenko Rakovic
  Performance   Level  
Name: Jasenko Rakovic <contact>
Classes: 2 packages by
Country: Bosnia and Herzegovina Bosnia and Herzegovina
Innovation award
Innovation award
Nominee: 1x

Example

<?php

require 'vendor/autoload.php';

use
Dzasa\MaratusPhpBackup\MaratusBackup;

$backup = new MaratusBackup();

$dbConfig = array(
  
'type' => 'mysql',
  
'host' => "localhost",
  
'port' => 3306,
  
'user' => 'root',
  
'pass' => '',
  
'database' => ''
);

$backup->addDatabase($dbConfig);

$dbConfigPg = array(
  
'type' => 'postgresql',
  
'host' => "localhost",
  
'port' => 5432,
  
'user' => '',
  
'pass' => '',
  
'database' => ''
);

$backup->addDatabase($dbConfigPg);

$dbConfigMongo = array(
  
'type' => 'mongodb',
  
'database' => '',
  
'host' => '',
  
'user' => 'dzasa',
  
'pass' => ''
);

$backup->addDatabase($dbConfigMongo);

$couchDbConfig = array(
'type' => 'couchdb',
'remote' => true,
'host' => 'localhost',
'user' => 'root',
'pass' => '',
'database' => '',
);
$backup->addDatabase($couchDbConfig);

$dbConfig2 = array(
  
'type' => 'mysql',
  
'host' => "localhost",
  
'port' => 3306,
  
'user' => '',
  
'pass' => '',
  
'database' => ''
);
$backup->addDatabase($dbConfig2);

$dBoxConfig = array(
  
'type'=> 'dropbox',
  
'access_token' => ''
);

$backup->addStorage($dBoxConfig);

$gDriveConfig = array(
  
'type'=> 'gdrive',
  
'client_id' => '',
  
'client_secret' => '',
  
'token_file' => 'gdrive-token.json',
  
'auth_code' => ''
);
$backup->addStorage($gDriveConfig);

$redisConfig = array(
'type' => 'redis',
'remote' => true,
'host' => '192.168.1.1',
'user' => 'root',
'private_key' => '',
'private_key_pass' => '',
'database_path' => "/var/lib/redis/dump.rdb",
);

$backup->addDatabase($redisConfig);

$riakConfig = array(
'type' => 'riak',
'remote' => true,
'host' => '192.168.1.1',
'user' => 'root',
'private_key' => '',
'private_key_pass' => '@',
'bitcask_path' => '/var/lib/riak/bitcask',
'leveldb_path' => '/var/lib/riak/leveldb',
'strong_consistency_path' => '/var/lib/riak/ensembles',
'remote_compress' => 'zip',
);
$backup->addDatabase($riakConfig);

$sqliteConfig = array(
   
'type' => 'sqlite',
   
'remote' => true,
   
'host' => '192.168.1.1',
   
'user' => 'root',
   
'private_key' => '',
   
'private_key_pass' => '',
   
'remote_compress' => 'zip',
   
'database_path' => '/root/backup',
);
$backup->addDatabase($sqliteConfig);

$copyConfig = array(
   
'type' => 'copy',
   
'consumer_key' => '',
   
'consumer_secret' => '',
   
'access_token' => '',
   
'token_secret' => '',
);

$backup->addStorage($copyConfig);

$localStorageConfig = array(
   
'type' => 'local',
   
'save_dir' => 'test2',
);

$backup->addStorage($localStorageConfig);

$ftpStorage = array(
   
'type' => 'ftp',
   
'host' => '192.168.1.1',
   
'user' => '',
   
'pass' => '',
   
'remote_dir' => 'test2',
);
$backup->addStorage($ftpStorage);

$backup->backup("tar.bz2");

print_r($backup->getDatabaseBackupResult());
echo
"-----------------------------\n";
print_r($backup->getStorageBackupResult());


  Files folder image Files  
File Role Description
Files folder imagesrc (1 file, 2 directories)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file example.php Example Full example
Accessible without login Plain text file google_get_code.php Example Example script

  Files folder image Files  /  src  
File Role Description
Files folder imageClients (5 files)
Files folder imageDatabases (7 files)
  Plain text file MaratusBackup.php Class Class source

  Files folder image Files  /  src  /  Clients  
File Role Description
  Plain text file Copy.php Class Class source
  Plain text file Dropbox.php Class Class source
  Plain text file Ftp.php Class Class source
  Plain text file GoogleDrive.php Class Class source
  Plain text file Local.php Class Class source

  Files folder image Files  /  src  /  Databases  
File Role Description
  Plain text file Couchdb.php Class Class source
  Plain text file Mongodb.php Class Class source
  Plain text file Mysql.php Class Class source
  Plain text file Postgresql.php Class Class source
  Plain text file Redis.php Class Class source
  Plain text file Riak.php Class Class source
  Plain text file Sqlite.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 93%
Total:420
This week:5
All time:6,381
This week:71Up
 User Ratings  
 
 All time
Utility:93%StarStarStarStarStar
Consistency:87%StarStarStarStarStar
Documentation:-
Examples:87%StarStarStarStarStar
Tests:-
Videos:-
Overall:64%StarStarStarStar
Rank:907