PHPackages                             mysqlnduhtool/mysqlnduhtool - 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. [Database &amp; ORM](/categories/database)
4. /
5. mysqlnduhtool/mysqlnduhtool

ActiveLibrary[Database &amp; ORM](/categories/database)

mysqlnduhtool/mysqlnduhtool
===========================

Mysql analyze tool. Find, log, mock and change your php database queries without touching your code.

901PHP

Since Dec 9Pushed 14y ago1 watchersCompare

[ Source](https://github.com/gimler/MySQLndUhTool)[ Packagist](https://packagist.org/packages/mysqlnduhtool/mysqlnduhtool)[ RSS](/packages/mysqlnduhtool-mysqlnduhtool/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

MySQLndUhTool, locate change control your mysql commands
========================================================

[](#mysqlnduhtool-locate-change-control-your-mysql-commands)

MySQLndUhTool is proxy that add events to the mysql commands. So you can not only log queries you get the line, file and server on which the spocky query was executed.

Requirements
------------

[](#requirements)

MySQLndUhTool requires mysqlnd and the pecl extension mysqlnd\_uh [2](http://pecl.php.net/package/mysqlnd_uh).

Installation
------------

[](#installation)

Installing MySQLndUhTool is as easy as it can get. Download the [`mysqlnduhtool.phar`](https://raw.github.com/gimler/MySQLndUhTool/master/mysqlnduhtool.phar)file and you're done!

Usage
-----

[](#usage)

Require the MySQLndUhTool phar file to use MySQLndUhTool in a script:

```
require_once '/path/to/MySQLndUhTool.phar';

```

Create a Symfony EventDispatcher instance:

```
use Symfony\Component\EvenDispatcher\EvenDispatcher;

$eventDispatcher = new EvenDispatcher();

```

Create a MySQLndUhTool Proxy instance with the dispatcher (which extends `MySQLndUhConnection`):

```
use MySQLndUhTool\Proxy;

$proxy = new Proxy($eventDispatcher);

```

Get build in informations
-------------------------

[](#get-build-in-informations)

How many query were executed:

```
$proxy->countExecutedQueries();

// unique queries
$proxy->countUniqueQueries());

```

Which queries were executed:

```
// get array with sql => backtrace
$proxy->getSqlQueries();

```

Check for sepcific query:

```
$proxy->hasQuery($sql);

```

Add listener to the events
--------------------------

[](#add-listener-to-the-events)

1. create a callback (closure, static function ...)

    ```
     $callback = function(MySQLndUhTool\Event\Query $event) {
         $backtrace = debug_backtrace();
         $file      = $backtrace[5]['file'];
         $line      = $backtrace[5]['line'];
         error_log(sprintf('%s line %u bullshit %s', $file, $line, $event->getQuery()));
     };

    ```
2. add the callback for specific event to the dispatcher

    ```
     $eventDispatcher->addListener(MySQLndUhTool\QueryEvents::FAIL, $callback[, $priority]);

    ```

Automatically integration in every php process
----------------------------------------------

[](#automatically-integration-in-every-php-process)

There are two usefull php ini option with that you can prepend the bootstrap of MySQLndUhTool `auto_prepend_file` and append option `auto_append_file` for log/output build in informations or do other stuff.

Technical Information
---------------------

[](#technical-information)

MySQLndUhTool is a proxy around the MySQLndUhConnection class it use the following fine PHP libraries:

- Symfony Components: ClassLoader, EventDispatcher

And the following pecl extension:

- mysqlnd\_uh

License
-------

[](#license)

MySQLndUhTool is licensed under the MIT license.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/685ac42edfee8d9cab853076b414ed64b5bf2567a875a00d6205e1846a721687?d=identicon)[gimler](/maintainers/gimler)

---

Top Contributors

[![gimler](https://avatars.githubusercontent.com/u/200904?v=4)](https://github.com/gimler "gimler (19 commits)")[![Seldaek](https://avatars.githubusercontent.com/u/183678?v=4)](https://github.com/Seldaek "Seldaek (1 commits)")

### Embed Badge

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

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

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.3k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M542](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M209](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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