fezfez/backup-manager
Composer 安装命令:
composer require fezfez/backup-manager
包简介
A framework agnostic database backup manager with user-definable procedures and support for S3, Dropbox, FTP, SFTP, and more with drivers for popular frameworks.
README 文档
README
This package provides a framework-agnostic database backup manager for dumping to and restoring databases from any file system.
- supports
MySQLandPostgreSQL - compress with
Gzip - framework-agnostic
- dead simple configuration
Quick and Dirty
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.
$local = new \League\Flysystem\Adapter\Local(getcwd() . '/data/'); $webdav = new \League\Flysystem\WebDAV\WebDAVAdapter(new \Sabre\DAV\Client([ 'baseUri' => getenv('WEBDAV_HOST'), 'userName' => getenv('WEBDAV_username'), 'password' => getenv('WEBDAV_password'), ]), 'remote.php/webdav/'); $manager = \Fezfez\BackupManager\BackupManager::create(); $manager->backup( new LeagueFilesystemAdapaterV1($local), new \Fezfez\BacpkupManager\Databases\MysqlDatabase( getenv('DB_HOST'), getenv('DB_PORT'), getenv('DB_USER'), getenv('DB_PASSWORD'), getenv('DB_DATABASE') ), [ new \Fezfez\BackupManager\Filesystems\Destination(new LeagueFilesystemAdapaterV1($webdav), 'test/backup.sql') ], \Fezfez\BackupManager\Compressors\GzipCompressor::create() ); $manager->restore( new LeagueFilesystemAdapaterV1($local), new LeagueFilesystemAdapaterV1($webdav), 'test/backup.sql', new \Fezfez\BacpkupManager\Databases\MysqlDatabase( getenv('DB_HOST'), getenv('DB_PORT'), getenv('DB_USER'), getenv('DB_PASSWORD'), getenv('DB_DATABASE') ), \Fezfez\BackupManager\Compressors\GzipCompressor::create() );
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 ^8.0
- MySQL support requires
mysqldumpandmysqlcommand-line binaries - PostgreSQL support requires
pg_dumpandpsqlcommand-line binaries - Gzip support requires
gzipandgunzipcommand-line binaries
Installation
Composer
Run the following to include this via Composer
composer require fezfez/backup-manager
Then, you'll need to select the appropriate packages for the adapters that you want to use.
# to support league-flysystem:^1.0 composer require fezfez/backup-manager-league-flysystem-v1 # to support league-flysystem:^2.0 composer require fezfez/backup-manager-league-flysystem-v2 # to support league-flysystem:^3.0 composer require fezfez/backup-manager-league-flysystem-v3
Usage
Once installed, the package must be bootstrapped (initial configuration) before it can be used.
We've provided a native PHP example here.
The required bootstrapping can be found in the example here.
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:
- Code style is PSR-2
- Interfaces should NOT be suffixed with
Interface, Traits should NOT be suffixed withTrait.
- Interfaces should NOT be suffixed with
- All methods and classes must contain docblocks.
- Ensure that you submit tests that have minimal 100% coverage. Given the project's simplicity it just makes sense.
- 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.
Backwards Compatibility Breaks
License
This package is licensed under the MIT license. Go wild.
fezfez/backup-manager 适用场景与选型建议
fezfez/backup-manager 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.65k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 05 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 fezfez/backup-manager 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 fezfez/backup-manager 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.65k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-05-16