2017 © Pedro Peláez
 

library pdo

PDO database library for Slim Framework

image

particlebits/pdo

PDO database library for Slim Framework

  • Saturday, July 28, 2018
  • by mikegioia
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 80 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

\Pb\PDO

Micro PDO Library

Latest Stable Version License, (*1)

Smallest possible PDO database while still being super useful, (*2)

Installation

Use Composer, (*3)

"require": {
    "ParticleBits/pdo": "~2.0"
}

Features

  • Compatible with PHP 5.6 and higher!
  • Tested on all versions of PHP 5.6 -> 7.4 (Not tested yet on PHP 8.x)
  • No dependencies other than the PDO extension
  • Tiny footprint

Usage

Examples selecting, inserting, updating and deleting data from or into the users table., (*4)

require_once 'vendor/autoload.php';

$dsn = 'mysql:host=your_db_host;dbname=your_db_name;charset=utf8';
$usr = 'your_db_username';
$pwd = 'your_db_password';

$pdo = new \Pb\PDO\Database($dsn, $usr, $pwd);

// SELECT * FROM users WHERE id = ?
$stmt = $pdo
    ->select()
    ->from('users')
    ->where('id', '=', 1234)
    ->execute();

$data = $stmt->fetch();

// INSERT INTO users (id , usr , pwd) VALUES (? , ? , ?)
$stmt = $pdo
    ->insert(['id', 'usr', 'pwd'])
    ->into('users')
    ->values([1234, 'your_username', 'your_password']);

$insertId = $stmt->execute(true); // true returns insert ID

// UPDATE users SET pwd = ? WHERE id = ?
$stmt = $pdo
    ->update(['pwd' => 'your_new_password'])
    ->table('users')
    ->where('id', '=', 1234);

$affectedRows = $stmt->execute();

// DELETE FROM users WHERE id = ?
$stmt = $pdo
    ->delete()
    ->from('users')
    ->where('id', '=', 1234);

$affectedRows = $stmt->execute();

Notes on the sqlsrv extension

The sqlsrv extension will fail to connect when using error mode PDO::ERRMODE_EXCEPTION (default). To connect, you will need to explicitly pass array(PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING) (or PDO::ERRMODE_SILENT) into the constructor, or override the getDefaultOptions() method when using sqlsrv., (*5)

Documentation

See DOCUMENTATION, (*6)

Changelog

See CHANGELOG, (*7)

License

See LICENSE, (*8)

The Versions

28/07 2018

dev-master

9999999-dev https://github.com/particlebits/pdo

PDO database library for Slim Framework

  Sources   Download

MIT

The Requires

  • php >= 5.6
  • ext-pdo *

 

database pdo

14/09 2015

1.8.0

1.8.0.0 https://github.com/FaaPz/Slim-PDO

PDO database library for Slim Framework

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-pdo *

 

database framework pdo slim

08/08 2015

1.7.2

1.7.2.0 https://github.com/FaaPz/Slim-PDO

PDO database library for Slim Framework

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-pdo *

 

database framework pdo slim

08/08 2015

1.7.1

1.7.1.0 https://github.com/FaaPz/Slim-PDO

PDO database library for Slim Framework

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-pdo *

 

database framework pdo slim

25/07 2015

1.7.0

1.7.0.0 https://github.com/FaaPz/Slim-PDO

PDO database library for Slim Framework

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-pdo *

 

database framework pdo slim