2017 © Pedro Peláez
 

library db

PHP Package for DB access from PHP. It contains simple common interface and can be used with many DB engines. It is very simple alternative of PDO

image

gelembjuk/db

PHP Package for DB access from PHP. It contains simple common interface and can be used with many DB engines. It is very simple alternative of PDO

  • Monday, October 31, 2016
  • by gelembjuk
  • Repository
  • 1 Watchers
  • 1 Stars
  • 37 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Gelembjuk/DB package

PHP Package for DB access from PHP. It contains simple common interface and can be used with many DB engines. It is very simple alternative of PDO., (*1)

Use it to have simple and fast way to access a DB with an abstract layer. So you can change a DB engine later., (*2)

Currently only 2 engines are supported: mysql and mysqli (Gelembjuk\DB\MySQL and Gelembjuk\DB\MySQLi), (*3)

Installation

Using composer: gelembjuk/db require: {"gelembjuk/db": "*"}, (*4)

Usage


require ('vendor/autoload.php'); // simple example to show how to work with 2 DB parelelly in a PHP script $dbsettings1 = array( 'user' => 'dbuser', 'password' => 'dbuserpassword', 'database' => 'mydb', 'host' => 'localhost', 'connectioncharset' => 'utf8', 'namescharset' => 'utf8' ); // different DB $dbsettings2 = array( 'user' => 'dbuser', 'password' => 'dbuserpassword', 'database' => 'mydb2', 'host' => 'localhost', 'connectioncharset' => 'utf8', 'namescharset' => 'utf8' ); $dbengine1 = new Gelembjuk\DB\MySQL($dbsettings1); $dbengine2 = new Gelembjuk\DB\MySQLi($dbsettings2); // connection will be established on a first request to a DB class MyTable extends Gelembjuk\DB\Base { public function getUsers() { return $this->getRows('SELECT * FROM users'); } public function addUser($name,$email) { $sql = "INSERT INTO users (name,email) VALUES ". "('".$this->quote($name)."','".$this->quote($email)."')"; $this->executeQuery(); return getLastInsertedId(); } } $mytable = new MyTable($dbengine1); $userid1 = $mytable->addUser('User 1','email@gmail.com'); $userid2 = $mytable->addUser('User 2','email2@gmail.com'); print_r($mytable->getUsers()); // this will do same but with different DB $mytable2 = new MyTable($dbengine2); print_r($mytable2->getUsers());

Author

Roman Gelembjuk (@gelembjuk), (*5)

The Versions

31/10 2016

dev-master

9999999-dev

PHP Package for DB access from PHP. It contains simple common interface and can be used with many DB engines. It is very simple alternative of PDO

  Sources   Download

MIT

The Requires

 

by Roman Gelembjuk

database mysql abstract database interface

31/10 2016

1.0.3

1.0.3.0

PHP Package for DB access from PHP. It contains simple common interface and can be used with many DB engines. It is very simple alternative of PDO

  Sources   Download

MIT

The Requires

 

by Roman Gelembjuk

database mysql abstract database interface

31/10 2016

1.0.2

1.0.2.0

PHP Package for DB access from PHP. It contains simple common interface and can be used with many DB engines. It is very simple alternative of PDO

  Sources   Download

MIT

The Requires

 

by Roman Gelembjuk

database mysql abstract database interface

07/03 2016

1.0.1

1.0.1.0

PHP Package for DB access from PHP. It contains simple common interface and can be used with many DB engines. It is very simple alternative of PDO

  Sources   Download

MIT

The Requires

 

by Roman Gelembjuk

database mysql abstract database interface

07/10 2015

1.0.0

1.0.0.0

PHP Package for DB access from PHP. It contains simple common interface and can be used with many DB engines. It is very simple alternative of PDO

  Sources   Download

MIT

The Requires

 

by Roman Gelembjuk

database mysql abstract database interface