PHPackages                             karlpatrickespiritu/simple-php-pdo-wrapper - 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. karlpatrickespiritu/simple-php-pdo-wrapper

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

karlpatrickespiritu/simple-php-pdo-wrapper
==========================================

a wrapper for php's pdo extension

v0.5(10y ago)10222MITPHPPHP &gt;=5.1.0

Since May 2Pushed 9y ago2 watchersCompare

[ Source](https://github.com/karlpatrickespiritu/simple-php-pdo-wrapper)[ Packagist](https://packagist.org/packages/karlpatrickespiritu/simple-php-pdo-wrapper)[ RSS](/packages/karlpatrickespiritu-simple-php-pdo-wrapper/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (2)Dependencies (1)Versions (2)Used By (0)

simple-php-pdo-wrapper
======================

[](#simple-php-pdo-wrapper)

a wrapper for php's pdo extension.

NO LONGER MAINTAINED. (Please use Laravel's Eloquent:  )

---

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

[](#installation)

via [composer](https://getcomposer.org/)

```
$ composer require karlpatrickespiritu/simple-php-pdo-wrapper
```

Getting Started
---------------

[](#getting-started)

Edit the `src/DB.config.php` file for your database configuration.

```
 [
        'host' => 'localhost',
        'port' => '',
        'dbname' => '',
        'username' => 'root',
        'password' => ''
    ],

    /**
     * Default PDO attributes. Modify accordingly.
     *
     * @see http://php.net/manual/en/pdo.setattribute.php
     */
    'PDO_ATTRIBUTES' => [
        PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
    ]
];
```

And that's it, you're good to go!

Usage
-----

[](#usage)

### Namespacing

[](#namespacing)

Make sure that this namespace is declared every time using the singleton `DB` class.

```
use PDO\DB;
```

#### Fetching

[](#fetching)

Fetch a single row in the result set

```
$singleRow = DB::i()->fetch('SELECT * FROM `users` WHERE `name` = :name', ['name' => 'Justin Beiber']);
```

Fetch a multiple rows in the result set

```
$multipleRows = DB::i()->fetchRows('SELECT * FROM `users`');
```

Extras

```
$multipleRows = DB::i()->fetchRows('SELECT * FROM `users`');

$rows = DB::i()->getRowCount(); // get the number of rows returned

$columns = DB::i()->getColumnCount(); // get the number of columns per row

var_dump($multipleRows);
var_dump($rows);
var_dump($columns);
```

#### Insertion

[](#insertion)

```
$params = [
    ':address' => 'Urgello St., Cebu City, 6000, Cebu',
    ':name' => 'Karl Espiritu',
    ':email' => 'wiwa.espiritu@gmail.com'
];

DB::i()->exec("INSERT INTO `users`(`name`, `address`, `email`) VALUES (:name, :address, :email)", $params);

var_dump(DB::i()->getLastId()); // dumps the last inserted id
```

#### Update

[](#update)

```
$params = [
    ":name" => "John Mayer",
    ":email" => "mayer@somesite.com",
    ":id" => 3
];

$affectedRows = DB::i()->exec("UPDATE `users` SET name = :name, email = :email WHERE id = :id", $params);

var_dump($affectedRows); // dumps the number of affected rows
```

#### Deletion

[](#deletion)

```
$affectedRows = DB::i()->exec("DELETE FROM `users` WHERE id = :id", [':id' => 1]);

var_dump($affectedRows); // dumps the number of affected rows
```

Maintainers
-----------

[](#maintainers)

- [@karlpartrickespiritu](https://github.com/karlpatrickespiritu)
- and [contributors](https://github.com/karlpatrickespiritu/simple-php-pdo-wrapper/graphs/contributors)

License
-------

[](#license)

(C) [Karl Patrick Espiritu](http://github.com/karlpatrickespiritu) 2015, released under the MIT license

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.7% 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

Unknown

Total

1

Last Release

3712d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10472504?v=4)[Karl Espiritu](/maintainers/karlpatrickespiritu)[@karlpatrickespiritu](https://github.com/karlpatrickespiritu)

---

Top Contributors

[![karlpatrickespiritu](https://avatars.githubusercontent.com/u/10472504?v=4)](https://github.com/karlpatrickespiritu "karlpatrickespiritu (58 commits)")[![JiNexus](https://avatars.githubusercontent.com/u/6903966?v=4)](https://github.com/JiNexus "JiNexus (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/karlpatrickespiritu-simple-php-pdo-wrapper/health.svg)

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

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k116.5M113](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

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