How to take database backup in laravel
We would like to share with you how to take database backup in laravel. the laravel provide “spatie/laravel-backup” package.
This package through we can easily take database backup based on daily and hourly using a command line. we can also take MySQL database backup and PostgreSQL database backup from laravel application using this package.
So you can follow the below steps for database backup.
Overview
Step 1: Install Package
Step 2: Backup Configuration
Step 3: Take Backup
Step 1: Install Package
Now, We will install spatie/laravel-backup package using the below command.
1 | composer require spatie/laravel-backup |
Step 2: Backup Configuration
This below command through we can automatically register service provider and publish this package.
1 | php artisan vendor:publish --provider="Spatie\Backup\BackupServiceProvider" |
Step 3: Take Backup
finally, we will take all the files and database using below command.
1 | php artisan backup:run |