承接 mrtnsn/backup-manager 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mrtnsn/backup-manager

Composer 安装命令:

composer require mrtnsn/backup-manager

包简介

Backup manager for Laravel

README 文档

README

Latest Version on Packagist Total Downloads

Easy to use backup manager for Laravel.

Features

  • Quick installation
  • Integration with Laravels queue and filesystem
  • Support for multiple Laravel versions (5.1 => 5.5)
  • Each table is stored in it's own file
  • Chunking of large tables

🔥 Breaking changes

In version 2.0.0 we changed how the backup files are created meaning that backups created before 2.0.0 can't be automatically imported. They can still be manually imported.

Installation

Composer

composer require mrtnsn/backup-manager

Provider

Add the service provider to providers in config/app.php so that it's registered in your Laravel application.

Mrtnsn\BackupManager\BackupManagerProvider::class,

Publish

If you need to change the default config you have to publish the config file.

php artisan vendor:publish --provider="Mrtnsn\BackupManager\BackupManagerProvider"

Usage

Commands

The package exposes two artisan commands, one for export and one for import.

Export

Export will use your current credentials and config to export the database to your desired location. This is done by creating a schema file from the database, then each table is inspected and split into chunks. Each chunk and the schema is uploaded to the desired location.

This command gives no feedback since it's meant to be run from the scheduler. This prevent filling up log files with unnecessary data.

The command can be execute manually with a custom tag, this can be useful if multiple developers are testing different databases on a staging server and need to quickly change between them.

Running it from schedule (app/Console/Kernel.php)
$schedule->command('backup-manager:export')
    ->daily();
Running it manually
php artisan backup-manager:export
Running it manually with custom tag
php artisan backup-manager:export --tag=newFeature

Import

Import will use your current credentials and config to import a selected backup.

This command is built to be run manually as it needs feedback to get the right backup.

You get to choose which subFolder and which version you want to restore. After this is selected it will loop through all files matching those parameteres and drop the table before importing it again.

This will cause minimal downtime as it only affects one table at a time.

Running it manually
php artisan backup-manager:import

Default config

Setting Default Description
disk local The Laravel filesystems disk to use
rootFolder backup-manager The root folder where all backups will be stored
subFolder date('Y-m-d') The sub folder all the backups for that instance will be stored in.
tag env('APP_ENV') Tag is added after the table name and before the version (e.g. {table}_{tag}1, {table}{tag}_2, etc.)
overwrite false If false the version will be incremented for each new save within the same sub folder. If true only version 1 will exist and each new save within the same sub folder will overwrite the content.
visibility private Visibility of the file, recommended to leave this as private. For more info take a look at the flysystem API: https://flysystem.thephpleague.com/api/
timestampFormat Y-m-d H:i:s This format is used for displaying the timestamps of imports
ignoreTables [] Tables you want to ignore from the backup.
chunkSize 50 How many MB each chunk of the data can be
mysqlGlobalSettings [] Here you can set global MySQL config if need, e.g. SET SQL_MODE="ALLOW_INVALID_DATES"

Roadmap

  • Tests
  • backup-manager:inspect to see files and info about a backup
  • Notification system for failed backups
  • Support for PostgreSQL

统计信息

  • 总下载量: 104
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-12-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固