dev-master
9999999-devdatabase automatic backup on user's disk
Creative Commons
The Requires
- php >=5.5.9
- nesbot/carbon ~1.21
by Rashedul Hoque Bhuiyan
php database backup laravel db auto backup
database automatic backup on user's disk
Database Auto Backup For Laravel 5.2 users, (*1)
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)
Set directory for database backup on web server.Add DB_BACKUP on .env file as follow, (*4)
When download is completed, add following line on app.php file in providers section, (*5)
\Rashed\Backup\DbBackupServiceProvider::class,
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', ],
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 .
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();
database automatic backup on user's disk
Creative Commons
php database backup laravel db auto backup