PHPackages                             plumphp/plum-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. plumphp/plum-pdo

ActiveLibrary

plumphp/plum-pdo
================

Integrations PDO into Plum.

v0.1.1(10y ago)1251[1 issues](https://github.com/plumphp/plum-pdo/issues)MITPHP

Since Apr 22Pushed 10y ago1 watchersCompare

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

READMEChangelog (2)Dependencies (3)Versions (4)Used By (0)

 [![Plum](https://camo.githubusercontent.com/a81342cbfd6f64a484988488ad37bbd0e665d0f14f65ec655ae986097447bfb6/687474703a2f2f63646e2e666c6f7269616e2e65632f706c756d2d6c6f676f2e737667)](https://camo.githubusercontent.com/a81342cbfd6f64a484988488ad37bbd0e665d0f14f65ec655ae986097447bfb6/687474703a2f2f63646e2e666c6f7269616e2e65632f706c756d2d6c6f676f2e737667)
==================================================================================================================================================================================================================================================================================================================================================================

[](#----)

> PlumPdo integrates [PDO](http://php.net/manual/en/book.pdo.php) into Plum. Plum is a data processing pipeline for PHP.

[![Build Status](https://camo.githubusercontent.com/65c1ff4c2bd1858347f2004a37599f5112e98d75deba7d71c5654f784b1dc5cf/68747470733a2f2f7472617669732d63692e6f72672f706c756d7068702f706c756d2d70646f2e737667)](https://travis-ci.org/plumphp/plum-pdo)[![Windows Build status](https://camo.githubusercontent.com/766d9274311bf3fbe7a3f85e75af5b22152db647ad4a499aa449a2e89f0d85c3/68747470733a2f2f63692e6170707665796f722e636f6d2f6170692f70726f6a656374732f7374617475732f377236753165766e6e6f6f39713563763f7376673d74727565)](https://ci.appveyor.com/project/florianeckerstorfer/plum-pdo)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/e986fdda95a9d286201c9820538b4e21f40ef3fae1ef6074ca99d39932965fbc/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f706c756d7068702f706c756d2d70646f2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/plumphp/plum-pdo/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/6482b114e4f1b14d99597fcaa603e77762335cfa75c4d19fee90631a4609aaec/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f706c756d7068702f706c756d2d70646f2f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/plumphp/plum-pdo/?branch=master)[![StyleCI](https://camo.githubusercontent.com/4af90f85c3cdeb8fbf27ca337186afcc5fe21154ca22904871c32e80a55bbf3d/68747470733a2f2f7374796c6563692e696f2f7265706f732f33303830343336392f736869656c64)](https://styleci.io/repos/30804369)

Developed by [Florian Eckerstorfer](https://florian.ec) in Vienna, Europe.

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

[](#installation)

You can install Plum using [Composer](http://getcomposer.org).

```
$ composer require plumphp/plum-pdo
```

Usage
-----

[](#usage)

Please refer to the [Plum documentation](https://github.com/plumphp/plum/blob/master/docs/index.md) for more information.

Currently PlumPdo contains `PdoStatementReader` to read data from a PDO-compatible database.

### `PdoStatementReader`

[](#pdostatementreader)

`Plum\PlumPdo\PdoStatementReader` returns an iterator for the result set of a `PDOStatement`. The `execute()` method has to be called before.

```
use Plum\PlumPdo\PdoStatementReader;

$statement = $pdo->prepare('SELECT * FROM users WHERE age >= :min_age');
$statement->bindValue(':min_age', 18);
$statement->execute();

$reader = new PdoStatementReader($statement);
$reader->getIterator(); // -> \ArrayIterator
$reader->count();
```

The default behavior shown in the example above is that `getIterator()` will call `fetchAll()` on the `PDOStatement`and returns the result in the form of an `\ArrayIterator`. However, if the result set is very large and memory becomes a concern it is possible to fetch the result set row by row and yield each row to the workflow. You can invoke the behaviour by setting the option `yield` to `true`.

In the following example `getIterator()` returns a `\Generator`.

```
use Plum\PlumPdo\PdoStatementReader;

$statement = $pdo->prepare('SELECT * FROM users WHERE age >= :min_age');
$statement->bindValue(':min_age', 18);
$statement->execute();

$reader = new PdoStatementReader($statement, ['yield' => true]);
$iterator = $reader->getIterator(); // -> \Generator
foreach ($iterator as $row) {
}
```

The downside of using `yield` is that the reader is no longer countable and when invoking `count()` on such a reader a `\RuntimeException` will be thrown.

Change Log
----------

[](#change-log)

### Version 0.1.1 (6 October 2015)

[](#version-011-6-october-2015)

- Fix Plum version

### Version 0.1 (22 April 2015)

[](#version-01-22-april-2015)

- Initial release

License
-------

[](#license)

The MIT license applies to plumphp/plum-pdo. For the full copyright and license information, please view the LICENSE file distributed with this source code.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

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 ~84 days

Total

3

Last Release

3877d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a80f9fc61cd3a7d7779e8f120b458ca4d18fdd885d719bb77d3379b96bf714d9?d=identicon)[florianeckerstorfer](/maintainers/florianeckerstorfer)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/plumphp-plum-pdo/health.svg)

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

PHPackages © 2026

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