2017 © Pedro Peláez
 

library database

A lightweight wrapper around PDO

image

leoshtika/database

A lightweight wrapper around PDO

  • Saturday, February 27, 2016
  • by leoshtika
  • Repository
  • 1 Watchers
  • 1 Stars
  • 61 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 3 % Grown

The README.md

A lightweight wrapper around PDO

License Packagist, (*1)

Requirements

  • PHP 5.3 or higher

Installation with Composer

  • from the command line
composer require leoshtika/database
  • or updating your composer.json file
{
    "require": {
        "leoshtika/database": "~1.1"
    }
}

Usage

Connect to an SQLite database

<?php
require_once 'vendor/autoload.php';

use leoshtika\libs\Sqlite;
use leoshtika\libs\UserFaker;

$sqliteFile = 'demo.sqlite';

// Create the database if not exists
UserFaker::create($sqliteFile);

$dbh = Sqlite::connect($sqliteFile);

$sth = $dbh->prepare('SELECT * FROM user');
$sth->execute();
$users = $sth->fetchAll(PDO::FETCH_ASSOC);

foreach ($users as $user) {
    echo $user['name'] . ' Email: ' . $user['email'];
    echo '


'; }

Connect to a MySQL database

require_once 'vendor/autoload.php';

use leoshtika\libs\Mysql;

$config = array(
    'host' => 'localhost',
    'dbname' => 'myapp',
    'user' => 'root',
    'pass' => '',
);

$dbh = Mysql::connect($config);

$sth = $dbh->prepare('SELECT * FROM user');
$sth->execute();
$users = $sth->fetchAll(PDO::FETCH_ASSOC);

foreach ($users as $user) {
    echo $user['name'] . ' Email: ' . $user['email'];
    echo '


'; }

Enjoy!, (*2)

The Versions

27/02 2016

dev-master

9999999-dev

A lightweight wrapper around PDO

  Sources   Download

MIT

The Requires

 

The Development Requires

27/02 2016

dev-develop

dev-develop

A lightweight wrapper around PDO

  Sources   Download

MIT

The Requires

 

The Development Requires

27/02 2016

v1.1.2

1.1.2.0

A lightweight wrapper around PDO

  Sources   Download

MIT

The Requires

 

The Development Requires

21/02 2016

v1.1.1

1.1.1.0

A lightweight wrapper around PDO

  Sources   Download

MIT

The Requires

 

The Development Requires

23/01 2016

v1.1.0

1.1.0.0

A lightweight wrapper around PDO

  Sources   Download

MIT

The Requires

 

The Development Requires

28/02 2015

v1.0.0

1.0.0.0

A lightweight wrapper around PDO

  Sources   Download

MIT

The Requires

 

The Development Requires

24/02 2015

v0.0.1

0.0.1.0

A lightweight wrapper around PDO

  Sources   Download

MIT

The Requires

 

The Development Requires