ext-pdo

Extended PDO for PHP. Allows to create connection from user-space or native PDO drivers.

4 years after

Extended PHP PDO

Extends PHP PDO support to provide an unified way to get PDO connection, using not only native driver (registered against basic PDO interface; e.g. PDO_MYSQL, PDO_PGSQL) but also custom/user-space driver (implementing PDO class).

Requirements:

Usage

See online documentation.

Register a user-space PDO:

require_once('ExtendedPDO.php');

ExtendedPDO::registerHook(function($dsn, $username, $password, $options) {
  if (!preg_match('^/custom:/', $dsn)) {
    return NULL; // Skip $dsn not accepted by this factory
  }

  // Your factory implementation
  return $a_PDO_instance;
});

Then PDO can be resolved, using user-space or native drivers.

// $dns = configured PDO DSN
$connection = ExtendedPDO::getInstance($dsn, "user", "password", NULL);
// $connection instanceof PDO

Related Repositories

php7-mysql-shim

php7-mysql-shim

A shim for ext/mysql in PHP 7+ ...

mysql

mysql

An async mysql client built on the amp concurrency framework ...

fastD

fastD

PHP Web Framework. ...

chef-cookbook-php

chef-cookbook-php

A Chef Cookbook for PHP, does not depend on apache and will not use or install p ...

packagist-crawler

packagist-crawler

make mirror of https://packagist.org ...


Top Contributors

cchantep