PHP Classes

File: README.md

Recommend this page to a friend!
  Classes of Unay Santisteban   Database PDO Abstract Layer   README.md   Download  
File: README.md
Role: Documentation
Content type: text/markdown
Description: Readme
Class: Database PDO Abstract Layer
Run queries with PDO and get results in XML, JSON
Author: By
Last change: Update of README.md
Date: 8 months ago
Size: 1,343 bytes
 

Contents

Class file image Download

OtherCode Database

Build Status Latest Stable Version License Total Downloads

Light database abstraction layer (PDO)

Currently supported:

  • MySQL
  • SQLite
  • Postgres

Installation

To install the package we only have to add the dependency to *composer.json* file:

"require": {
  "othercode/database": "*"
}

And run the following command:

composer update

Install without Composer

Also we can use this library without Composer, we only have to include in our script the "database/autoload.php" file.

require_once "database/autoload.php".

Configuration

Now we have to create the instance and add a new connection to it.

$db = new OtherCode\Database\Database();

$db->addConnection(array(
    'driver' => 'mysql',
    'host' => 'localhost',
    'dbname' => 'test',
    'username' => 'username',
    'password' => 'password'
));