heybigname/backup-manager 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

heybigname/backup-manager

最新稳定版本:0.3.9

Composer 安装命令:

composer require heybigname/backup-manager

包简介

Database backup manager for dumping to and restoring databases from S3, Dropbox, FTP, and SFTP.

README 文档

README

This repository has been completely removed and should NO LONGER be used. Find the new and improved version at Backup Manager.

Seriously, don't use this repo.

Database Backup Manager

Latest Stable Version License Build Status Coverage Status Total Downloads

  • supports MySQL and PostgreSQL
  • compress with Gzip
  • framework-agnostic
  • dead simple configuration
  • optional integrations for MVC framework Laravel

This package is completely framework agnostic. Mitchell has put together a video tour of Laravel integration, to give you an idea what is possible with this package.

Table of Contents

Stability Notice

It's stable enough, you'll need to understand permissions.

This package is actively being developed and we would like to get feedback to improve it. Please feel free to submit feedback.

Quick and Dirty

Configure your databases.

// config/database.php
'development' => [
    'type' => 'mysql',
    'host' => 'localhost',
    'port' => '3306',
    'user' => 'root',
    'pass' => 'password',
    'database' => 'test',
],
'production' => [
    'type' => 'postgresql',
    'host' => 'localhost',
    'port' => '5432',
    'user' => 'postgres',
    'pass' => 'password',
    'database' => 'test',
],

Configure your filesystems.

// config/storage.php
'local' => [
    'type' => 'Local',
    'root' => '/path/to/working/directory',
],
's3' => [
    'type' => 'AwsS3',
    'key'    => '',
    'secret' => '',
    'region' => Aws\Common\Enum\Region::US_EAST_1,
    'bucket' => '',
    'root'   => '',
],
'rackspace' => [
    'type' => 'Rackspace',
    'username' => '',
    'key' => '',
    'container' => '',
    'zone' => '',
    'root' => '',
],
'dropbox' => [
    'type' => 'Dropbox',
    'key' => '',
    'secret' => '',
    'app' => '',
    'root' => '',
],
'ftp' => [
    'type' => 'Ftp',
    'host' => '',
    'username' => '',
    'password' => '',
    'root' => '',
    'port' => 21,
    'passive' => true,
    'ssl' => true,
    'timeout' => 30,
],
'sftp' => [
    'type' => 'Sftp',
    'host' => '',
    'username' => '',
    'password' => '',
    'root' => '',
    'port' => 21,
    'timeout' => 10,
    'privateKey' => '',
],

Backup to / restore from any configured database.

Backup the development database to Amazon S3. The S3 backup path will be test/backup.sql.gz in the end, when gzip is done with it.

$manager = require 'bootstrap.php';
$manager->makeBackup()->run('development', 's3', 'test/backup.sql', 'gzip');

Backup to / restore from any configured filesystem.

Restore the database file test/backup.sql.gz from Amazon S3 to the development database.

$manager = require 'bootstrap.php';
$manager->makeRestore()->run('s3', 'test/backup.sql.gz', 'development', 'gzip');

This package does not allow you to backup from one database type and restore to another. A MySQL dump is not compatible with PostgreSQL.

Requirements

  • PHP 5.4
  • MySQL support requires mysqldump and mysql command-line binaries
  • PostgreSQL support requires pg_dump and psql command-line binaries
  • Gzip support requires gzip and gunzip command-line binaries

Installation

Composer

Run the following to include this via Composer

composer require heybigname/backup-manager

Then, you'll need to select the appropriate packages for the adapters that you want to use.

# to support s3
composer require league/flysystem-aws-s3-v2

# to support dropbox
composer require league/flysystem-dropbox

# to support rackspace
composer require league/flysystem-rackspace

# to support sftp
composer require league/flysystem-sftp

Usage

Once installed, the package must be bootstrapped (initial configuration) before it can be used. If you're using Laravel then skip directly to the Laravel integration section.

We've provided a native PHP example here.

The required bootstrapping can be found in the example here.

Integrations

The backup manager is easy to integrate into your favorite frameworks. We've included Laravel integration. We're definitely accepting pull-requests.

Laravel

To install into a Laravel project, first do the composer install then add the following class to your config/app.php service providers list.

'BigName\BackupManager\Integrations\Laravel\BackupManagerServiceProvider',

Then, publish and modify the configuration file to suit your needs.

php artisan config:publish heybigname/backup-manager --path=vendor/heybigname/backup-manager/config

The Backup Manager will make use of Laravel's database configuration.

IoC Resolution

Manager can be automatically resolved through constructor injection thanks to Laravel's IoC container.

use BigName\BackupManager\Manager;

public function __construct(Manager $manager) {
    $this->manager = $manager;
}

It can also be resolved manually from the container.

$manager = App::make('BigName\BackupManager\Manager');

Artisan Commands

There are three commands available db:backup, db:restore and db:list.

All will prompt you with simple questions to successfully execute the command.

Contribution Guidelines

We recommend using the vagrant configuration supplied with this package for development and contribution. Simply install VirtualBox, Vagrant, and Ansible then run vagrant up in the root folder. A virtualmachine specifically designed for development of the package will be built and launched for you.

When contributing please consider the following guidelines:

  • please conform to the code style of the project, it's essentially PSR-2 with a few differences.
    1. The NOT operator when next to parenthesis should be surrounded by a single space. if ( ! is_null(...)) {.
    2. Interfaces should NOT be suffixed with Interface, Traits should NOT be suffixed with Trait.
  • All methods and classes must contain docblocks.
  • Ensure that you submit tests that have minimal 100% coverage.
  • When planning a pull-request to add new functionality, it may be wise to submit a proposal to ensure compatibility with the project's goals.

Maintainers

This package is maintained by Mitchell van Wijngaarden and Shawn McCool of Big Name

License

This package is licensed under the MIT license.

heybigname/backup-manager 适用场景与选型建议

heybigname/backup-manager 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 24.89k 次下载、GitHub Stars 达 17, 最近一次更新时间为 2014 年 04 月 16 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 heybigname/backup-manager 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 heybigname/backup-manager 我们能提供哪些服务?
定制开发 / 二次开发

基于 heybigname/backup-manager 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 17
  • Watchers: 4
  • Forks: 215
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-04-16