Skip to content

baad777/mysqlbackup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

alt tag Latest Stable Version Latest Unstable Version License Total Downloads

Simple Mysql Backup Package

I wrote this simple package, so I can swiftly dump my database whenever I need to. Also, in conjunction with Laravel 5 console commands, you can quickly setup a backup schedule. If you have the time, you can make your own implementation of PersistenceInterface, and save the dumps to S3/Google Drive/etc.

Requirements

  • php 5.5+
  • mysqldump

Instalation

composer require bancuadrian/mysqlbackup

Usage

You can use the BackupService class to quickly start dumping databases.

  <?php
      $backupStatus = \BancuAdrian\MysqlBackup\BackupService::backup('username','password',['database1','database2'],'/path/to/backup');
  ?>

$backupStatus returns true if all are successful, or false otherwise.

Usage Laravel 5.*

After composer require, add this line to your config/app.php , providers section.

  BancuAdrian\MysqlBackup\Support\ServiceProvider::class

If you want an alias, you can add this to the alias array

  'BackupManager' => BancuAdrian\MysqlBackup\Support\Facade::class

Publish the config file

  php artisan vendor:publish --provider="BancuAdrian\MysqlBackup\Support\ServiceProvider"

You can now find the config in config/mysqlbackup.php . Edit it to suite your needs.

You can then backup your databases using:

  \BackupManager::backupAll();
  // or for single database
  \BackupManager::backup('databaseName');

Features to come (soon I hope)

  • Restore
  • Backup to Google Drive
  • Backup to S3
  • Limit the number of backups in a folder
  havefun() && contribute() && !criticize() && give_advice();

About

backup your mysql

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages