r-tk / rtk-db
RTK DB
dev-master
2018-03-26 20:09 UTC
Requires (Dev)
This package is auto-updated.
Last update: 2024-04-08 14:48:57 UTC
README
DB connections manager with some unifying between adapters
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();