PHPackages                             tomwright/extended-pdo - 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. tomwright/extended-pdo

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

tomwright/extended-pdo
======================

An extension on the standard PDO library.

1.0.2(9y ago)25542PHP

Since Nov 10Pushed 8y ago1 watchersCompare

[ Source](https://github.com/TomWright/ExtendedPDO)[ Packagist](https://packagist.org/packages/tomwright/extended-pdo)[ RSS](/packages/tomwright-extended-pdo/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (2)Versions (14)Used By (2)

Extended PDO
============

[](#extended-pdo)

[![Build Status](https://camo.githubusercontent.com/a61567391dfd775870485abda7cef2915b914fd0587467b86e069ce5b0554919/68747470733a2f2f7472617669732d63692e6f72672f546f6d5772696768742f457874656e64656450444f2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/TomWright/ExtendedPDO)[![Latest Stable Version](https://camo.githubusercontent.com/be47611446749202fab4b2699067f780dff83eddd6ac8d61911387e99f1d2a55/68747470733a2f2f706f7365722e707567782e6f72672f746f6d7772696768742f657874656e6465642d70646f2f762f737461626c65)](https://packagist.org/packages/tomwright/extended-pdo)[![Total Downloads](https://camo.githubusercontent.com/d38d1535a57205a0e8323098ce3d21086f525cffee475bafc8e6b65dd409f194/68747470733a2f2f706f7365722e707567782e6f72672f746f6d7772696768742f657874656e6465642d70646f2f646f776e6c6f616473)](https://packagist.org/packages/tomwright/extended-pdo)[![Monthly Downloads](https://camo.githubusercontent.com/da41fccf2834db5bfb9ae6f7dd547d18e66b85c28dcefcf0a1d5abcaa02bae15/68747470733a2f2f706f7365722e707567782e6f72672f746f6d7772696768742f657874656e6465642d70646f2f642f6d6f6e74686c79)](https://packagist.org/packages/tomwright/extended-pdo)[![Daily Downloads](https://camo.githubusercontent.com/59d132228540dcc3c7f9e9b9a2c811a4b651cdf9220502eac585fc16bef64ac9/68747470733a2f2f706f7365722e707567782e6f72672f746f6d7772696768742f657874656e6465642d70646f2f642f6461696c79)](https://packagist.org/packages/tomwright/extended-pdo)[![License](https://camo.githubusercontent.com/af9bc87b8b0b862f9760af78dfbb30032e92f4ed01c8baaf8d991428796aaac3/68747470733a2f2f706f7365722e707567782e6f72672f746f6d7772696768742f657874656e6465642d70646f2f6c6963656e73652e737667)](https://packagist.org/packages/tomwright/extended-pdo)

Installation
------------

[](#installation)

```
composer install tomwright/extended-pdo

```

Connecting
----------

[](#connecting)

ExtendedPDO implements the singleton design pattern using [tomwright/singleton](https://github.com/TomWright/Singleton). For more information on how the following code works, see the [documentation](https://github.com/TomWright/Singleton).

```
$db = ExtendedPDO::createConnection($dsn, $username, $password, 'my-main-db');
$db2 = ExtendedPDO::getInstance('my-main-db');

var_dump($db === $db2) // TRUE
```

Usage
-----

[](#usage)

```
// Returns an array of records
$db->queryAll('SELECT * FROM users WHERE username = :username', [':username' => 'Tom']);

// Returns the first record
$db->queryRow('SELECT * FROM users WHERE username = :username LIMIT 1', [':username' => 'Tom']);
```

Query Return Types
------------------

[](#query-return-types)

You can set the return type of the `dbQuery()`, `queryAll()` and `queryRow()` methods using `$db->setReturnType($x)` where `$x` is the return type you'd like to use.

Available return types are as follows:

- `ExtendedPDO::RETURN_TYPE_OBJECT` - Your results will be returned as objects
- `ExtendedPDO::RETURN_TYPE_ASSOC` - Your results will be returned as associative arrays
- `ExtendedPDO::RETURN_TYPE_STMT` - The statement object will be returned directly

You can also set a return type of `\PDO::FETCH_ASSOC` for example and it will override any of the above. This makes all of the standard `PDO` fetch types usable.

Query Builder
-------------

[](#query-builder)

ExtendedPDO also comes with it's own [Query Builder](https://github.com/TomWright/QueryBuilderPHP).

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~16 days

Recently: every ~23 days

Total

13

Last Release

3327d ago

Major Versions

0.0.10 → 1.0.02017-03-24

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/935867?v=4)[Tom Wright](/maintainers/TomWright)[@TomWright](https://github.com/TomWright)

---

Top Contributors

[![TomWright](https://avatars.githubusercontent.com/u/935867?v=4)](https://github.com/TomWright "TomWright (38 commits)")

---

Tags

databasedatabase-accessmysqlpdopdo-wrapperphpphp-7query-buildersingletonsql

### Embed Badge

![Health badge](/badges/tomwright-extended-pdo/health.svg)

```
[![Health](https://phpackages.com/badges/tomwright-extended-pdo/health.svg)](https://phpackages.com/packages/tomwright-extended-pdo)
```

###  Alternatives

[pestphp/pest

The elegant PHP Testing Framework.

11.6k72.2M19.4k](/packages/pestphp-pest)[drupal/core-dev

require-dev dependencies from drupal/drupal; use in addition to drupal/core-recommended to run tests from drupal/core.

2022.6M324](/packages/drupal-core-dev)

PHPackages © 2026

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