aaronwebb/aura-sql-debug

Extends an Aura ExtendedPdo connection with debug logging.

dev-master 2015-07-13 01:24 UTC

README

Build Status

This library provides a decorated connection that logs profiles of PDO commands to a standard PSR-3 logger.

Installation

Install the latest version with

require aaronwebb/aura-sql-debug

Basic Usage

<?php
use Aura\Sql\ExtendedPdo;
use Aura\Sql\Profiler;
use Webb\Aura\Sql\ExtendedDebugPdo;

$logger = new Logger('database');
$logger->pushHandler(new ErrorLogHandler());

$pdo = new ExtendedDebugPdo(
  new ExtendedPdo(
    'mysql:host=localhost;dbname=test',
    'username',
    'password',
    array(), // driver options as key-value pairs
    array()  // attributes as key-value pairs
  ),
  $logger,
  new Profiler()
);