Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

how to backup laravel project with database

//First install laravel spatie using following commands
composer require spatie/laravel-backup
php artisan vendor:publish --provider="SpatieBackupBackupServiceProvider"

//now in config/backup.php file replace replace 
relative_path = null, 
  to
relative_path= base_path(),

//now add this code inside config/database.php
'connections' => [
	'mysql' => [
		'driver'    => 'mysql'
		...,
		'dump' => [
                'dump_binary_path' => 'C:xamppmysqlin', // only the path, so without `mysqldump` or `pg_dump`
                'use_single_transaction',
                'timeout' => 60 * 5, // 5 minute timeout
                'exclude_tables' => ['table1', 'table2'
                ],             ]
	],
//now run following command to generate backup of project with database
php artisan backup:run
//you can find the backup files inside storageapp
Source by spatie.be #
 
PREVIOUS NEXT
Tagged: #backup #laravel #project #database
ADD COMMENT
Topic
Name
6+4 =