y0lk/sqldumper
Composer 安装命令:
composer require y0lk/sqldumper
包简介
SQL dump utility
关键字:
README 文档
README
SQLDumper is a small library designed to easily create customized SQL dumps.
Installation
Via Composer
$ composer require y0lk/sqldumper
Usage
The concept is that you can select tables and set certain "dump parameters" for each table, made so you can chain a bunch of calls to quickly create a customized dump.
use Y0lk\SQLDumper\SQLDumper; //Init the dumper with your DB info $dumper = new SQLDumper('localhost', 'dbname', 'root', ''); //Set all tables to dump without data and without DROP statement $dumper->allTables() ->withData(false) ->withDrop(false); //Set table1 to dump with data $dumper->table('table1') ->withData(true); //Set table2 and table3 to dump without structure (data only), and table3 with where condition $dumper->listTables([ 'table2', 'table3' ]) ->withStructure(false) ->table('table3') ->where('id=2 OR foo="bar"'); //This will group DROP statements and put them at the beginning of the dump $dumper->groupDrops(true); //This will group INSERT statements and put them at the end of the dump $dumper->groupInserts(true); $dumper->save('dump.sql');
Dumper options
groupDrops(bool $group)
When set to TRUE, this will group DROP statements and put them at the beginning of the dump
groupInserts(bool $group)
When set to TRUE, this will group INSERT statements and put them at the end of the dump
Table selection
There are 3 basic methods to select tables. When a table or a list of tables are selected, they are returned as TableDumper objects on which you can set options for the dump.
allTables()
Selects all the tables in the DB
table(string|Table $table)
Select by table's name (string) or a Table object
listTables(array $listTables)
Select by a list of table names (string) or Table object
Table options
This is the list of methods available on each each TableDumper
withStructure(bool $withStructure)
Whether to dump the table CREATE structure
withData(bool $withData)
Whether to dump table data (INSERT statement)
withDrop(bool $withDrop)
Wheter to include the DROP statement (before CREATE)
where(string $where_string)
WHERE query string as regular SQL
Output
dump(resource $stream)
This the main dump function, outputs the dump to a stream.
save(string $filename)
Saves the dump to a file
License
The MIT License (MIT). Please see License File for more information.
y0lk/sqldumper 适用场景与选型建议
y0lk/sqldumper 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.08k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2016 年 11 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「sql」 「dump」 「mysql」 「mysql-dump」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 y0lk/sqldumper 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 y0lk/sqldumper 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 y0lk/sqldumper 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This package will add the `dd` and `dump` helpers to your Phalcon application.
Dibi is Database Abstraction Library for PHP
Simple Twig extension improving templates debugging
nice output for debug functions for PHP 5.3
Query filtering in your frontend
Database/ORM-agnostic query construction helper
统计信息
- 总下载量: 2.08k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-11-18