r-tk/rtk-db

RTK DB

Maintainers

Details

github.com/r-tk/rtk-db

Source

Issues

Installs: 22

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/r-tk/rtk-db

dev-master 2018-03-26 20:09 UTC

This package is auto-updated.

Last update: 2025-10-08 17:59:31 UTC


README

DB connections manager with some unifying between adapters

Latest version travis-ci Coverage Status License Total Downloads

Define connection

use RTK\DB\DB;

DB::addInstance('default', array(
	'type'      => 'mysqli',
	'host'      => 'localhost',
	'user'      => 'root',
	'password'  => '',
	'database'  => 'test',
));
// or
DB::addInstance('default', array(
	'type'      => 'PDOMysql',
	'host'      => 'localhost',
	'user'      => 'root',
	'password'  => '',
	'database'  => 'test',
));
// or
DB::addInstance('default', array(
	'type'      => 'PDOMysql',
	'dsn'      => 'mysql:dbname=test;host=localhost',
	'user'      => 'root',
	'password'  => '',
));

Get connection instance

use RTK\DB\DB;

$db = DB::get('default');

// omitting instance name will return instance 'default'
$db = DB::get();