PHPackages                             sjoerdmaessen/pdodebug - 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. sjoerdmaessen/pdodebug

ActiveLibrary

sjoerdmaessen/pdodebug
======================

Small package to be able to easily debug prepared statements

04.4k[1 issues](https://github.com/sjoerdmaessen/pdodebug/issues)PHP

Since Apr 4Pushed 9y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

PDO Debug
=========

[](#pdo-debug)

A collection of small debugging classes.

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

```
php composer.phar require sjoerdmaessen/pdodebug "dev-master"
```

Usage
-----

[](#usage)

In a simple project which includes PDO the easiest way is set the class Sjoerdmaessen\\PDODebug\\Statement as the user-supplied statement class. For example:

```
// Init db
$dbOptions = array(
	PDO::ATTR_EMULATE_PREPARES => true,
	PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
	PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,
	PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
);

// Add additional database debugging methods
if ($app->isInDebugMode()) {
	$dbOptions[PDO::ATTR_STATEMENT_CLASS] = array('\Sjoerdmaessen\PDODebug\Statement', array());
}

$db = new PDO('mysql:host=localhost;dbname=' . DB_NAME, DB_USER, DB_PASSWORD, $dbOptions);
```

Now, when calling getQuery() you will see a parsed version of the query with its bounded parameters. Optionally the method getFormattedErrorInfo() sometimes give some usefull and quick (but basic) information what the cause of the query error could be.

For a project with Doctrine where you have the QueryBuilder object:

```
$qb = $this->createQueryBuilder('t');
echo '';
var_dump(DoctrineQuery::getQuery($qb));
```

Or if you have a native query:

```
$nativeQuery = $this->getEntityManager()->createNativeQuery($sql, $result)->setParameter('user_id', $user->getId());
echo '';
var_dump(\Sjoerdmaessen\PDODebug\DoctrineQuery::getQuery($nativeQuery));
```

Or, just plain SQL with some parameters:

```
echo '';
var_dump(\Sjoerdmaessen\PDODebug\DoctrineQuery::getQuery($sql, ['user_id' => $user->getId()]));
```

Contributing
------------

[](#contributing)

This package is an open source project. Contribution is highly appreciated.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% 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/28aeb8157b1ee2ef370c4b3900394e3f1b67c93f77723562671f7301f0e50d93?d=identicon)[sjoerdmaessen](/maintainers/sjoerdmaessen)

---

Top Contributors

[![sjoerdmaessen](https://avatars.githubusercontent.com/u/858124?v=4)](https://github.com/sjoerdmaessen "sjoerdmaessen (2 commits)")[![svenluijten](https://avatars.githubusercontent.com/u/11269635?v=4)](https://github.com/svenluijten "svenluijten (2 commits)")

### Embed Badge

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

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

PHPackages © 2026

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