PHPackages                             koriym/dev-pdo-statement - 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. koriym/dev-pdo-statement

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

koriym/dev-pdo-statement
========================

A PDOStatement for develop

0.1.0(10y ago)1610.7k1[1 issues](https://github.com/koriym/Koriym.DevPdoStatement/issues)1MITPHP

Since Feb 24Pushed 2y ago1 watchersCompare

[ Source](https://github.com/koriym/Koriym.DevPdoStatement)[ Packagist](https://packagist.org/packages/koriym/dev-pdo-statement)[ RSS](/packages/koriym-dev-pdo-statement/feed)WikiDiscussions 1.x Synced 2mo ago

READMEChangelogDependenciesVersions (4)Used By (1)

A PdoStatement for Developers
=============================

[](#a-pdostatement-for-developers)

[![Continuous Integration](https://github.com/koriym/Koriym.DevPdoStatement/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/koriym/Koriym.DevPdoStatement/actions/workflows/continuous-integration.yml)

\[[Japanese](README.ja.md)\]

[koriym/dev-pdo-statement](https://packagist.org/packages/koriym/dev-pdo-statement) log following information to help your sql inspection.

- Query excution time.
- Final SQL query with parameter values interpolated into it from prepared statement.
- The result of `EXPLAIN` query.
- The result of `SHOW WARNINGS` query.

Install
-------

[](#install)

Attach`DevPdoStatement`class to the target `$pdo`.

```
use Koriym\DevPdoStatement\DevPdoStatement;
use Koriym\DevPdoStatement\Logger;

$pdo->setAttribute(\PDO::ATTR_STATEMENT_CLASS, [DevPdoStatement::class, [$pdo, new Logger]]);
```

Then `$pdo` start to log as following on each query.

```
time:0.00035190582275391 query: INSERT INTO user(id, name) VALUES (99, 'koriym99')
time:0.00020503997802734 query: SELECT id, name FROM user where id > 80
warnings:[
    {
        "Level": "Note",
        "Code": "1003",
        "Message": "\/* select#1 *\/ select `tmp`.`user`.`id` AS `id`,`tmp`.`user`.`name` AS `name` from `tmp`.`user` where (`tmp`.`user`.`id` > 80)"
    }
]
explain :[
    {
        "id": "1",
        "select_type": "SIMPLE",
        "table": "user",
        "partitions": null,
        "type": "ALL",
        "possible_keys": null,
        "key": null,
        "key_len": null,
        "ref": null,
        "rows": "100",
        "filtered": "33.33",
        "Extra": "Using where"
    }
]

```

Custom Log
----------

[](#custom-log)

You can implement custom condition for logging or choose your favorite logger.

```
use Koriym\DevPdoStatement\LoggerInterface;

class MyPsr3Logger implements LoggerInterface
{
    /**
     * {@inheritdoc}
     */
    public function logQuery($query, $time, array $explain, array $warnings)
    {
        // log or throw exception in your custom condition.
    }
}
```

Demo
====

[](#demo)

```
php doc/demo/run.php
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.3% 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 ~2868 days

Total

2

Last Release

864d ago

Major Versions

0.1.0 → 1.x-dev2024-01-02

### Community

Maintainers

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

---

Top Contributors

[![koriym](https://avatars.githubusercontent.com/u/529021?v=4)](https://github.com/koriym "koriym (48 commits)")[![kumamidori](https://avatars.githubusercontent.com/u/384567?v=4)](https://github.com/kumamidori "kumamidori (7 commits)")

---

Tags

pdo

### Embed Badge

![Health badge](/badges/koriym-dev-pdo-statement/health.svg)

```
[![Health](https://phpackages.com/badges/koriym-dev-pdo-statement/health.svg)](https://phpackages.com/packages/koriym-dev-pdo-statement)
```

###  Alternatives

[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k578.4M5.6k](/packages/doctrine-dbal)[ifsnop/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k5.5M69](/packages/ifsnop-mysqldump-php)[nette/database

💾 Nette Database: layer with a familiar PDO-like API but much more powerful. Building queries, advanced joins, drivers for MySQL, PostgreSQL, SQLite, MS SQL Server and Oracle.

5656.7M234](/packages/nette-database)[dibi/dibi

Dibi is Database Abstraction Library for PHP

5013.8M120](/packages/dibi-dibi)[aura/sql

A PDO extension that provides lazy connections, array quoting, query profiling, value binding, and convenience methods for common fetch styles. Because it extends PDO, existing code that uses PDO can use this without any changes to the existing code.

5632.5M43](/packages/aura-sql)[aura/sqlquery

Object-oriented query builders for MySQL, Postgres, SQLite, and SQLServer; can be used with any database connection library.

4572.9M34](/packages/aura-sqlquery)

PHPackages © 2026

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