PHPackages                             rlanvin/php-mypdo - 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. rlanvin/php-mypdo

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

rlanvin/php-mypdo
=================

Wrapper for PDO (MySQL) to support auto-reconnect, nested transactions and more.

v1.0.2(10y ago)74.5k[2 issues](https://github.com/rlanvin/php-mypdo/issues)MITPHPPHP &gt;=5.3.0

Since Aug 17Pushed 9y ago2 watchersCompare

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

READMEChangelog (3)DependenciesVersions (4)Used By (0)

MyPDO
=====

[](#mypdo)

MyPDO is a wrapper that adds a few features missing from vanilla PDO:

- Explicit disconnection
- Automatic reconnection (no more *2006 MySQL server has gone away*)
- Nested transactions
- Methods chainability
- Hidden password from the stack trace (in case of error)
- Helpers methods (e.g. `ping()`)

**Important: MyPDO is designed for MySQL only.**

This class will not add higher logic to PDO (such as data mapping, etc.). It is only intended to add low-level features.

[![Build Status](https://camo.githubusercontent.com/40eeb3c31f883d9eae8e84a48d70492eee05ecff66eba97178d22cf351bb59fc/68747470733a2f2f7472617669732d63692e6f72672f726c616e76696e2f7068702d6d7970646f2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/rlanvin/php-mypdo)

Basic example
-------------

[](#basic-example)

This class is intented to be a drop-in replacement for PHP's default PDO. There is nothing special to do, just use `MyPDO` class instead of `PDO` and you're good to go.

Complete doc is available in [the wiki](https://github.com/rlanvin/php-mypdo/wiki).

Requirements
------------

[](#requirements)

- PHP &gt;= 5.3

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

[](#installation)

The recommended way is to install the lib [through Composer](http://getcomposer.org/).

Just add this to your `composer.json` file (change the version by the release you want, or use `dev-master` for the development version):

```
{
    "require": {
        "rlanvin/php-mypdo": "1.*"
    }
}
```

Then run `composer install` or `composer update`.

Now you can use the autoloader, and you will have access to the library:

```
