shinjin/pdo

A PDO wrapper, because the internet needed another PDO wrapper

0.6.3 2018-04-05 23:22 UTC

This package is not auto-updated.

Last update: 2024-04-28 02:43:01 UTC


README

Build Status Coverage Status

A PDO wrapper, because the internet needed another PDO wrapper.

Use shinjin/pdo if you need a thin wrapper that:

  • uses arrays to unpack query values
  • uses prepared statements to execute queries and bulk operations
  • supports upserts (insert or update on duplicate key)
  • supports nested transactions

Install

Via Composer

$ composer require shinjin/pdo

Usage

$connection_parameters = array(
    'driver'   => 'mysql',
    'dbname'   => 'dbtest',
    'user'     => 'shinjin',
    'password' => 'awesomepasswd'
);

$db = new Db($connection_parameters);

$statement  = 'SELECT * FROM guestbook WHERE id = ?';
$parameters = array(1);

$result = $db->query($statement, $parameters)->fetchAll();

See Usage for a complete list of examples.

Change log

See CHANGELOG.

Testing

$ composer test

Contributing

Bugfixes and updates to support new db drivers are welcome. Please submit pull requests to Github.

Authors

License

The MIT License (MIT). Please see License File for more information.