2017 © Pedro Peláez
 

library pdo-log

A simple way to log PDO queries and execution times.

image

herrera-io/pdo-log

A simple way to log PDO queries and execution times.

  • Friday, August 23, 2013
  • by kherge
  • Repository
  • 1 Watchers
  • 7 Stars
  • 132,005 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 2 Versions
  • 2 % Grown

The README.md

PDO Log

![Build Status], (*1)

This library provides an alternative class to PDO. Its purpose is to log queries and their execution times. You can also set an observer that will be called whenever a new log entry is added., (*2)

$pdo = new Herrera\Pdo\Pdo('sqlite::memory');

$pdo->onLog(
    function (array $entry) {
        print_r($entry);
    }
);

$pdo->exec('CREATE TABLE test ()');

/*
Array
(
    [query] => CREATE TABLE test ()
    [time] => 0.00026607513427734
    [values] => Array
        (
        )
)
*/

// retrieves all logged queries
$entries = $pdo->getLog();

Installation

Use Composer:, (*3)

$ composer require "herrera-io/pdo-log=~1.0"

Usage

The logging Pdo class is a subclass of the real PDO class, so the only thing that has been changed is adding the ability to log certain actions, and that query() and prepare() will return the logging version of the PDOStatement class. This version of the class is not a subclass of the original, but all property gets/sets and method calls are mirrored. You can still retrieve the real instance using PdoStatement->getPdoStatement()., (*4)

The Versions

23/08 2013

dev-master

9999999-dev http://github.com/herrera-io/php-pdo-log

A simple way to log PDO queries and execution times.

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-pdo *

 

The Development Requires

debug log pdo

23/08 2013

1.0.0

1.0.0.0 http://github.com/herrera-io/php-pdo-log

A simple way to log PDO queries and execution times.

  Sources   Download

MIT

The Requires

  • php >=5.3.3
  • ext-pdo *

 

The Development Requires

debug log pdo