Laravel Database Backup using Laravel Backup Package

Laravel Database Backup using Laravel Backup Package

In this post we will give you information about Laravel Database Backup using Laravel Backup Package. Hear we will give you detail about Laravel Database Backup using Laravel Backup PackageAnd how to use it also give you demo for it if it is necessary.

In this post, i want to show you how to take database backup using Laravel backup package. this package will provide command to take backup from your live server and that command you can use in crontab file on server, that way you can get backup daily on every hourly etc as you want. Database backup is very important for your projects.

This is a proper example and very simple way to use. in this example you can download mysql database backup using laravel backup package. one more thing this will work if you have php 5.5.9 or higher and Laravel 5.1.20 or higher. so let’s start from install “Laravel Backup” package.

Installation Package

composer require spatie/laravel-backup

Add ServiceProvider

Now open config/app.php file and add service provider.

'providers' => [

....

SpatieBackupBackupServiceProvider::class,

]


Publish Config File

following command through you can create publish config file for laravel backup package. after fire this command you can see one file app/config/laravel-backup.php and you can change your own setting.

php artisan vendor:publish --provider="SpatieBackupBackupServiceProvider"

Ok, now we are ready to take a mysql database or PostgreSQL backup from using bellow command.

php artisan backup:run

At last you can find file storage/app/backupfile in your storage directory. in that folder store all backups date-time wise will save. above command you can add on your server cronbob file.

you can take more information about laravel backup package from here : Laravel Package. If you want to set using laravel cron job than you can also follow this link: Example of Cron Job in Laravel 5

Hope this code and post will helped you for implement Laravel Database Backup using Laravel Backup Package. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

Your email address will not be published. Required fields are marked *

3  +  5  =  

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US