PHPackages                             php-kit/ext-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. php-kit/ext-pdo

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

php-kit/ext-pdo
===============

An extension to the standard PHP PDO API

1.1.3(8y ago)432.8k↓30%3MITPHPPHP &gt;=5.4.0

Since Nov 30Pushed 8mo ago4 watchersCompare

[ Source](https://github.com/php-kit/ext-pdo)[ Packagist](https://packagist.org/packages/php-kit/ext-pdo)[ Docs](https://github.com/php-kit/ext-pdo)[ RSS](/packages/php-kit-ext-pdo/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (7)Used By (3)

Ext-PDO
=======

[](#ext-pdo)

Ext-PDO is a lightweight extension to PHP's native PDO API that ships sensible defaults for the most popular database drivers and adds a few helper methods to streamline everyday database work.

Features
--------

[](#features)

- **Driver-aware factory** – `ExtPDO::create()` instantiates the appropriate subclass for MySQL, PostgreSQL, SQLite or SQL Server, so you only need to provide driver-agnostic connection settings.
- **Safer transaction handling** – transparent tracking of the transaction depth prevents accidental commits when you are using nested transactions and only calls through to PDO when the outermost transaction succeeds.
- **Convenience helpers** – `exec()`, `select()` and `get()` accept bound parameters directly and return useful values without requiring boilerplate prepared-statement code.
- **Optimized connection defaults** – the bundled driver subclasses configure error modes, fetch modes, timeouts and driver-specific options like ANSI quotes for MySQL so you do not have to remember to tune them yourself.
- **Environment-driven configuration (optional)** – the `Connection` and `Connections` helpers can bootstrap connections from environment variables or custom factories, making it easy to centralize connection management in larger applications.

Benefits
--------

[](#benefits)

- Reduce boilerplate when running parameterized queries and fetching results thanks to helper methods.
- Gain predictable error handling and data fetching behaviour from the sensible defaults applied to each driver.
- Safely compose higher-level data access routines that require nested transactions.
- Standardize how connections are created across environments while keeping the flexibility to override options when necessary.

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

[](#installation)

Install the package via Composer:

```
composer require php-kit/ext-pdo
```

Usage
-----

[](#usage)

### Creating a connection directly

[](#creating-a-connection-directly)

```
use PhpKit\ExtPDO\ExtPDO;

$pdo = ExtPDO::create('mysql', [
    'host' => '127.0.0.1',
    'database' => 'app',
    'username' => 'app_user',
    'password' => 'secret',
    'charset' => 'utf8mb4',
]);

$pdo->beginTransaction();

try {
    // Run parameterized statements without manual statement preparation.
    $pdo->exec('INSERT INTO posts (title, body) VALUES (?, ?)', ['Hello', 'First post']);

    // Quickly fetch a single value.
    $postCount = $pdo->get('SELECT COUNT(*) FROM posts');

    // Or work with a full result set.
    $statement = $pdo->select('SELECT * FROM posts WHERE id = ?', [1]);
    $post = $statement->fetch();

    $pdo->commit();
} catch (Throwable $e) {
    $pdo->rollBack();
    throw $e;
}
```

You can override any PDO options at creation time by passing an `$optionsOverride` array as the third argument to `ExtPDO::create()`.

### Loading connections from the environment

[](#loading-connections-from-the-environment)

```
use PhpKit\ExtPDO\Connections;

$connections = new Connections();

// Reads DB_DRIVER, DB_HOST, DB_DATABASE, DB_USERNAME, etc. from the environment.
$default = $connections->get();

// Register additional named connections when needed.
$connections->register('reporting', function () {
    // Build and return a Connection instance here.
});
```

Set environment variables such as `DB_DRIVER`, `DB_HOST`, `DB_DATABASE`, `DB_USERNAME`, and `DB_PASSWORD` (or their `NAME_`-prefixed variants for named connections) to let Ext-PDO configure the connection automatically.

---

Copyright © 2015 Impactwave, Lda.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance43

Moderate activity, may be stable

Popularity31

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 96.6% 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 ~122 days

Total

5

Last Release

2964d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/750f00fdbb8cb2fd1c11c5c26b512217451bb001ac48a77542efa7123b9e2124?d=identicon)[impactwave](/maintainers/impactwave)

---

Top Contributors

[![claudio-silva](https://avatars.githubusercontent.com/u/1999803?v=4)](https://github.com/claudio-silva "claudio-silva (28 commits)")[![goncalomartins](https://avatars.githubusercontent.com/u/19184021?v=4)](https://github.com/goncalomartins "goncalomartins (1 commits)")

### Embed Badge

![Health badge](/badges/php-kit-ext-pdo/health.svg)

```
[![Health](https://phpackages.com/badges/php-kit-ext-pdo/health.svg)](https://phpackages.com/packages/php-kit-ext-pdo)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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