PHPackages                             census/sql - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. census/sql

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

census/sql
==========

一个用来解析binlog的到sql的包

1.3.4(5y ago)132MITPHPPHP &gt;=7.3.0

Since Mar 2Pushed 5y ago1 watchersCompare

[ Source](https://github.com/gspgsp/mysql-binlog-census)[ Packagist](https://packagist.org/packages/census/sql)[ RSS](/packages/census-sql/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (11)Used By (0)

census
======

[](#census)

一个用来解析binlog的到sql的包，主要是之前准备用binlog做恢复的操作，但是后来没有找到合适的插件，有考虑过有考虑过用ali的canal，这个功能介绍的很全，但是使用起来会有些问题，服务端可以跑起来，但是 做数据同步的时候一直有问题，php的客户端没什么问题。可以正常获取到数据。后来找到 krowinski/php-mysql-replication 包，准备加点数据处理的功能在里面。

[![Build Status](https://camo.githubusercontent.com/8d6ce306dddfe81c36afd5ed39fd0bf23d637821f3a60838e7d4155c8c89ad41/68747470733a2f2f7472617669732d63692e636f6d2f6773706773702f6d7973716c2d62696e6c6f672d63656e7375732e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/github/gspgsp/mysql-binlog-census)

安装
--

[](#安装)

```
$ composer require census/sql -vvv
```

运行环境要求
------

[](#运行环境要求)

```
- PHP 7.3+
- Mysql 5.7+

```

使用
--

[](#使用)

基于Laravel框架，在Commands目录下，新建命令BinlogConsumer，代码如下：

```
    namespace App\Console\Commands\BinlogWatcher;

    use Illuminate\Console\Command;
    use Parse\Sql\Binlog;
    use Parse\Sql\Exceptions\Exception;
    use Parse\Sql\Exceptions\InvalidArgumentException;
    use Parse\Sql\Exceptions\InvalidInstanceException;

    class BinlogConsumer extends Command
    {
        protected $signature = 'binlog-consumer';

        // 命令描述信息
        protected $description = '监听binlog日志服务';

        public function handle()
        {
            try {
                (new Binlog(config('sys.binlogConsumer')))->watcher();
            } catch (Exception $exception) {
                $message = $exception->getMessage();

                // 参数异常捕获
                if ($exception instanceof InvalidArgumentException) {
                    $message = '参数异常:' . $message . PHP_EOL;
                }

                // 实例化异常捕获
                if ($exception instanceof InvalidInstanceException) {
                    $message = '实例化异常:' . $message . PHP_EOL;
                }

                echo $message;
            }
        }

    }

```

如果打算用supervisorctl来执行上面的脚本的话，会有问题，因为上面的程序执行后本身就是守护进程 所以通过nohup方式运行： nohup php artisan binlog-consumer &gt; /var/log/binlog-operate.log 2&gt;&amp;1 &amp;

建议
--

[](#建议)

License
-------

[](#license)

MIT

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 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 ~0 days

Total

10

Last Release

1899d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f943315a99e7f6ef7a529c6db461c546f86df4695e26eecc0f0e34bc5bb62b11?d=identicon)[chetaixian](/maintainers/chetaixian)

---

Top Contributors

[![gspgsp](https://avatars.githubusercontent.com/u/16269496?v=4)](https://github.com/gspgsp "gspgsp (17 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/census-sql/health.svg)

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

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[laragear/populate

Populate your database with a supercharged, continuable seeder

8611.8k](/packages/laragear-populate)

PHPackages © 2026

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