PHPackages                             sanderheijselaar/ezpdo - 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. sanderheijselaar/ezpdo

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

sanderheijselaar/ezpdo
======================

 A simple PHP PDO class for MySQL

0.3.0(7y ago)21.1k↓94.1%1MITPHP

Since Apr 30Pushed 7y ago1 watchersCompare

[ Source](https://github.com/sanderheijselaar/ezpdo)[ Packagist](https://packagist.org/packages/sanderheijselaar/ezpdo)[ RSS](/packages/sanderheijselaar-ezpdo/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (10)Used By (0)

\#EZ PDO Querying made simple &amp; safe with PDO

\##Installation Install the composer package () or download and include the ezPdo.php file in your project

\##Usage Create new SimplePDO instance or use the existing one:

```
use SanderHeijselaar\EzPdo\EzPdo;

$dbh = new EzPdo(
	EzPdo::DB_TYPE_MYSQL,
	'localhost',
	'db_name',
	'db_user',
	'db_pass');

```

Drop an existing table:

```
$sql = "
    DROP TABLE IF EXISTS `person`;
";

$result = $dbh->update($sql,array());
var_export($result);

```

Create a new table:

```
$sql = "
    CREATE TABLE `person` (
        `id`  smallint UNSIGNED NOT NULL AUTO_INCREMENT ,
        `name`  char(32) NOT NULL ,
        `email`  char(64) NOT NULL ,
        `phone`  char(16) NOT NULL ,
        PRIMARY KEY (`id`)
    );
";

$result = $dbh->update($sql,array());
var_export($result);

```

Insert rows into the new table:

```
$sql = "
    INSERT INTO
		`person` (`name`, `email`, `phone`)
	VALUES
		('Simon', 'simon@simon.com', '+31612345678');
";

$result = $dbh->insert($sql,array());
var_export($result);

$sql = "
    INSERT INTO
		person` (`name`, `email`, `phone`)
	VALUES
		('Sander', 'sander@sander.com', '+31612345678');
";

$result = $dbh->insert($sql,array());
var_export($result);

$sql = "
    INSERT INTO
		`person` (`name`, `email`, `phone`)
	VALUES
		('Barry', 'barry@barry.com', '+31612345678');
";

$result = $dbh->insert($sql,array());
var_export($result);

```

Retrieve all rows:

```
$sql = "
    SELECT
		*
	FROM
		`person`
	ORDER BY
		`id` ASC;
";

$result = $dbh->getResults($sql,array());
var_export($result);

```

Update a row by id:

```
$sql = "
    UPDATE
		`person`
	SET
		`phone` = :phone
	WHERE
		`id` = :id
";
$sqlData = array(
    'id'    => 1,
    'phone' => '+31688888888',
);

$result = $dbh->update($sql, $sqlData);
var_export($result);

```

Retrieve by column:

```
$sql = "
    SELECT `phone` FROM `person` ORDER BY `id` ASC;
";

$result = $dbh->getCol($sql,array());
var_export($result);

```

Delete a row by id:

```
$sql = "
    DELETE FROM `person` WHERE `id` = :id
";
$sqlData = array(
    'id'    => 2,
);

$result = $dbh->delete($sql, $sqlData);
var_export($result);

```

Select a column by id:

```
$sql = "
    SELECT `phone` FROM `person` WHERE `id` = :id;
";
$sqlData = array(
    'id'    => 1,
);

$result = $dbh->getVar($sql, $sqlData);
var_export($result);

```

Select multiple rows using the WHERE ... IN (...) statement with an array:

```
$sql = "
    SELECT `id` FROM `person` WHERE `phone` IN (:phone);
";
$sqlData = array(
    'phone' => array(
        '+31612345677',
        '+31612345678',
        '+31612345679',
        '+31688888888',
    ),
);

$result = $dbh->getCol($sql, $sqlData);
var_export($result);

```

Make a query that throws an EzPdoException:

```
try {
    $sql = "
        SELECT `phone` FROM `ERROR` WHERE `id` = :id;
    ";
    $sqlData = array(
        'id'    => 1,
    );

    $result = $dbh->getVar($sql, $sqlData);
    var_export($result);
} catch (SanderHeijselaar\EzPdo\EzPdoException $ex) {
    var_export($ex->getMessage());
}

```

Get the parsed query. Only use this for debugging queries:

```
try {
    $sql = "
        SELECT `phone` FROM `ERROR` WHERE `id` = :id;
    ";
    $sqlData = array(
        'id'    => 1,
    );

    $result = $dbh->returnParsedQuery($sql, $sqlData);
    echo $result;
} catch (SanderHeijselaar\EzPdo\EzPdoException $ex) {
    var_export($ex->getMessage());
}

```

**Licensed under MIT**

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

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

Recently: every ~236 days

Total

9

Last Release

2918d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2448c74415930663c076b78b5e81eec428c3d0abb6aa04724fe2cb84663f1cda?d=identicon)[sheijselaar](/maintainers/sheijselaar)

---

Top Contributors

[![sanderheijselaar](https://avatars.githubusercontent.com/u/2115388?v=4)](https://github.com/sanderheijselaar "sanderheijselaar (8 commits)")

---

Tags

phpmysqlsqlitepostgresqlpdo

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sanderheijselaar-ezpdo/health.svg)

```
[![Health](https://phpackages.com/badges/sanderheijselaar-ezpdo/health.svg)](https://phpackages.com/packages/sanderheijselaar-ezpdo)
```

###  Alternatives

[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k605.0M6.8k](/packages/doctrine-dbal)[vcian/laravel-db-auditor

Database DB Auditor provide leverage to audit your MySql,sqlite, PostgreSQL database standards and also provide options to add constraints in table.

28638.1k1](/packages/vcian-laravel-db-auditor)[aura/sqlschema

Provides facilities to read table names and table columns from a database using PDO.

44243.2k4](/packages/aura-sqlschema)[delight-im/db

Safe and convenient SQL database access in a driver-agnostic way

50174.0k7](/packages/delight-im-db)[popphp/pop-db

Pop Db Component for Pop PHP Framework

1816.5k12](/packages/popphp-pop-db)

PHPackages © 2026

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