yet another pdo wrapper
PHP
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
README.md
composer.json

README.md

STYROFOAM

A small PDO Wrapper class, trying to evolve to a small ORM.

Install

Using git

$ git clone https://github.com/samayo/styrofoam.git

Using composer

$ php composer.phar require samayo/styrofoam:2.0.*

Usage

require 'path/to/styrofoam.php'

$db = new Styrofoam\Database(
    'mysql:host=localhost; dbname=***;  charset=utf8', 'xx', 'xx', [
        PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
        PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC 
    ]);

CRUD

// returns result in array
$select = $db->select('SELECT * FROM users WHERE id = ?', [145]);
// returns lastInsertId() on success
$insert = $db->insert('INSERT INTO users (lastname) VALUES (?)', ['robin']);
// returns bool
$delete = $db->delete('DELETE FROM users WHERE id = ?', [456]);
// returns bool
$update = $db->update('UPDATE cars SET color = ? WHERE model = ?', ['blue', 'Toyota']);

License

MIT