PHPackages                             dyike/sqltool - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. dyike/sqltool

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

dyike/sqltool
=============

sql diff tool.

v1.2.0(9y ago)226MITPHPPHP &gt;=5.6

Since Sep 8Pushed 9y ago1 watchersCompare

[ Source](https://github.com/dyike/sqlTool)[ Packagist](https://packagist.org/packages/dyike/sqltool)[ Docs](https://github.com/dyike/sqlTool)[ RSS](/packages/dyike-sqltool/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (6)Used By (0)

SqlTool
=======

[](#sqltool)

[![Build Status](https://camo.githubusercontent.com/b772f9680a2f7546e2805d5e563773fd9450c1237a177f4a78bcf9718b3860cf/68747470733a2f2f7472617669732d63692e6f72672f6479696b652f73716c546f6f6c2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/dyike/sqlTool)

基于PHP编写的查看线上线下数据库更新修改的状态，同时生成相应的sql语句。

安装
--

[](#安装)

使用 Composer 安装:

```
composer require "dyike/sqlTool:~1.2"

```

使用
--

[](#使用)

### 查看线上线下数据库的表，新增表、新增字段、修改字段的sql

[](#查看线上线下数据库的表新增表新增字段修改字段的sql)

```
use Dyike\Sqltool\Sql;
use Dyike\Sqltool\JudgeSql;

$tableOffLine = new Sql('hostOnLine', 'dbName', 'dbUser', 'dbPassword', 'dbPort');
$tableOnLine = new Sql('hostOFFLine', 'dbName', 'dbUser', 'dbPassword', 'dbPort');

//线上的数据表
$tOnLine = $tableOnLine->getTables();
//线下的数据表
$tOffLine = $tableOffLine->getTables();

$judgeSql = new JudgeSql();
//新增的数据
$getTablesToAdd = $judgeSql->getTableToAdd($tOnLine, $tOffLine);
foreach ($getTablesToAdd as $value) {
    //获取新增表的创建SQL
    $sql = $tableOffLine->getCreateTableSql($value);
    print_r($sql);
    echo "";
}

foreach ($tOnLine as $value) {
    //获取线下表的字段
    $fieldsOffLine = $tableOffLine->getFields($value);
    //获取线上表的字段
    $fieldsOnLine = $tableOnLine->getFields($value);
    //新增字段的SQL
    $addFieldSql = $judgeSql->toAddFieldSql($fieldsOffLine, $fieldsOnLine, $value);
    //修改更新字段的SQL
    $updateFieldSql = $judgeSql->toUpdateFields($fieldsOffLine, $fieldsOnLine, $value);
}
```

License
=======

[](#license)

MIT

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~4 days

Total

5

Last Release

3513d ago

### Community

---

Top Contributors

[![dyike](https://avatars.githubusercontent.com/u/4496772?v=4)](https://github.com/dyike "dyike (32 commits)")

### Embed Badge

![Health badge](/badges/dyike-sqltool/health.svg)

```
[![Health](https://phpackages.com/badges/dyike-sqltool/health.svg)](https://phpackages.com/packages/dyike-sqltool)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
