laravel-backup maintained by gelaku
Installing
composer require gelaku/laravel-backup -vvv
使用
Laravel 配置写在 config/database.php 中:
.
.
.
// 数据库备份
'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);
Usage
TODO
Contributing
You can contribute in one of three ways:
- File bug reports using the issue tracker.
- Answer questions or fix bugs on the issue tracker.
- Contribute new features or update the wiki.
The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.
License
MIT