2017 © Pedro Peláez
 

library database-backup

database automatic backup on user's disk

image

rashed/database-backup

database automatic backup on user's disk

  • Tuesday, August 9, 2016
  • by shuvrow
  • Repository
  • 1 Watchers
  • 1 Stars
  • 209 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 2 % Grown

The README.md

DB-Backup

Database Auto Backup For Laravel 5.2 users, (*1)

Installation

Db-backup is a laravel package. You can install it via composer.In your project directory run following command:, (*2)

composer require 'rashed/database-backup':'dev-master', (*3)

Configuration

Set directory for database backup on web server.Add DB_BACKUP on .env file as follow, (*4)

DB_BACKUP=directory_name

When download is completed, add following line on app.php file in providers section, (*5)

\Rashed\Backup\DbBackupServiceProvider::class,

publish

Now run following command from terminal, (*6)

php artisan config:clear 
composer dump-autoload -o

This will publish all necessary file for this package., (*7)

Now on app/Providers/EventServiceProvider.php file add following lines in $listen variable., (*8)

'Rashed\Backup\Events\DbBackupEvent' => [
        'Rashed\Backup\Listeners\DbBackupEventListener',
    ],

Usages

Event::fire(new \Rashed\Backup\Events\DbBackupEvent());

Note:, (*9)

  • Use this event to export database in your local disk.
  • This event store database on user's machine and remove it from server.
  • If you want to store database on server periodically Make sure your configure it first. Schedule Backup .

schedule-backup

This option required configuration for db auto backup on server using task scheduling. To use this option you have to add a cron entry on your server., (*10)

* * * * * php /path/to/artisan schedule:run >> /dev/null 2>&1

After adding this, add following line on app/Console/kernel.php file:, (*11)

use Rashed\Backup\Commands\Backup;

and add following line in $commands variable, (*12)

Backup::class,

And on schedule() function add scheduler as your requirements., (*13)

For example if you want to backup your database after every 30 minutes write following code, (*14)

$schedule->command('Backup')->everyThirtyMinutes();

backup your database after every 10 minutes , write following code :, (*15)

$schedule->command('Backup')->everyTenMinutes();

The Versions

09/08 2016

dev-master

9999999-dev

database automatic backup on user's disk

  Sources   Download

Creative Commons

The Requires

 

by Rashedul Hoque Bhuiyan

php database backup laravel db auto backup