PHP code example of gelaku / laravel-backup

1. Go to this page and download the library: Download gelaku/laravel-backup library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gelaku / laravel-backup example snippets


.
.
.
// 数据库备份
'backup'=>[
    // 数据库备份路径
    'path' => './backup/',
    // 数据库备份卷大小
    'part' => 20971520,
    // 数据库备份文件是否启用压缩 0不压缩 1 压缩
    'compress' => 0,
    // 数据库备份文件压缩级别 1普通 4 一般  9最高
    'level' => 9,
],

use Gelaku\LaravelBackup\Backup;
$backup = new Backup();

// 数据类表列表
$data = $backup->dataList();
// 备份文件列表
$data = $backup->fileList();
// 备份数据库表单
$data = $backup->backup($table);
// 导入表
$time = $request->input('time');
$file  = $backup->getFile('timeverif',$time);
$data = $backup->setFile($file)->import(0,$time);
// 修复表
$data = $backup->repair($tables);
// 优化表
$data = $backup->optimize($tables);
// 下载
$data = $backup->downloadFile($time);