Log SQL statements executed using a PDO instance

1.0 2013-08-17 02:16 UTC


Build Status

Wrapper around PDO to provide information about executed statements.

$pdo = new TraceablePDO(new PDO($dsn));

$result = $pdo->query('select * from mytable');

$tracedStmt = $pdo->getLastTracedStatements();
printf("The last query took %sms to execute", $tracedStmt->getDuration());

Also provides a ProxyTraceablePDO for custom PDO sublasses. Wrap your custom PDO object inside it and property access and method calls will be forwarded.

Install using composer:

    "require": {
        "maximebf/traceable-pdo": "1.*"