beaten-sect0r/yii2-db-manager
Composer 安装命令:
composer require beaten-sect0r/yii2-db-manager
包简介
The db dump manager module for Yii2
关键字:
README 文档
README
Click on a ⭐!
MySQL/PostgreSQL Database Backup and Restore functionality
Installation
The preferred way to install this extension is through composer.
Either run
composer require --prefer-dist beaten-sect0r/yii2-db-manager "*"
or add
"beaten-sect0r/yii2-db-manager": "*"
to the require section of your composer.json file.
Configuration
Once the extension is installed, simply add it in your config by:
Basic config/web.php
Advanced backend/config/main.php
Simple config
'modules' => [ 'db-manager' => [ 'class' => 'bs\dbManager\Module', // path to directory for the dumps 'path' => '@app/backups', // list of registerd db-components 'dbList' => ['db'], // Flysystem adapter (optional) creocoder\flysystem\LocalFilesystem will be used as default. 'flySystemDriver' => 'creocoder\flysystem\LocalFilesystem', 'as access' => [ 'class' => 'yii\filters\AccessControl', 'rules' => [ [ 'allow' => true, 'roles' => ['admin'], ], ], ], ], ],
Advanced config
'components' => [ // https://github.com/creocoder/yii2-flysystem 'backupStorage' => [ 'class' => 'creocoder\flysystem\FtpFilesystem', 'host' => 'ftp.example.com', //'port' => 21, //'username' => 'your-username', //'password' => 'your-password', //'ssl' => true, //'timeout' => 60, //'root' => '/path/to/root', //'permPrivate' => 0700, //'permPublic' => 0744, //'passive' => false, //'transferMode' => FTP_TEXT, ], ], 'modules' => [ 'db-manager' => [ 'class' => 'bs\dbManager\Module', // Flysystem adapter (optional) creocoder\flysystem\LocalFilesystem will be used as default. 'flySystemDriver' => 'creocoder\flysystem\LocalFilesystem', // path to directory for the dumps 'path' => '@app/backups', // list of registerd db-components 'dbList' => ['db', 'db1', 'db2'], // process timeout 'timeout' => 3600, // additional mysqldump/pg_dump presets (available for choosing in dump and restore forms) 'customDumpOptions' => [ 'mysqlForce' => '--force', 'somepreset' => '--triggers --single-transaction', 'pgCompress' => '-Z2 -Fc', ], 'customRestoreOptions' => [ 'mysqlForce' => '--force', 'pgForce' => '-f -d', ], // options for full customizing default command generation 'mysqlManagerClass' => 'CustomClass', 'postgresManagerClass' => 'CustomClass', // option for add additional DumpManagers 'createManagerCallback' => function($dbInfo) { if ($dbInfo['dbName'] == 'exclusive') { return new MyExclusiveManager; } else { return false; } } 'as access' => [ 'class' => 'yii\filters\AccessControl', 'rules' => [ [ 'allow' => true, 'roles' => ['admin'], ], ], ], ], ],
Console config
'modules' => [ 'db-manager' => [ 'class' => 'bs\dbManager\Module', // Flysystem adapter (optional) creocoder\flysystem\LocalFilesystem will be used as default. 'flySystemDriver' => 'creocoder\flysystem\LocalFilesystem', // path to directory for the dumps 'path' => '@app/backups', // list of registerd db-components 'dbList' => ['db'], ], ],
Make sure you create a writable directory named backup on app root directory.
Usage
Pretty url's /db-manager
No pretty url's index.php?r=db-manager
Console usage
-db - db component, default value: db
-gz - gzip archive
-s - file storage
-f - file name, default last dump
Create dump
php yii dump/create -db=db -gz -s
Restore dump
php yii dump/restore -db=db -s -f=dump.sql
Deleting all dumps
php yii dump/delete-all
Test database connection
php yii dump/test-connection -db=db
Changelog
- Flysystem support
- Console support
- Multiple database management
- Ability for customize dump and restore options; dump and restore processors
- Ability for run operations asynchronously
- Ability for compressing dumps
beaten-sect0r/yii2-db-manager 适用场景与选型建议
beaten-sect0r/yii2-db-manager 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 44.46k 次下载、GitHub Stars 达 92, 最近一次更新时间为 2016 年 05 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「dump」 「backup」 「yii2」 「db manager」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 beaten-sect0r/yii2-db-manager 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 beaten-sect0r/yii2-db-manager 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 beaten-sect0r/yii2-db-manager 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This package will add the `dd` and `dump` helpers to your Phalcon application.
A SDK for working with B2 cloud storage.
Simple Twig extension improving templates debugging
nice output for debug functions for PHP 5.3
A custom URL rule class for Yii 2 which allows to create translated URL rules
A sleek PHP wrapper around rclone with Laravel-style fluent API syntax
统计信息
- 总下载量: 44.46k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 93
- 点击次数: 15
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2016-05-27
