1. Go to this page and download the library: Download safronik/db-wrapper library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
safronik / db-wrapper example snippets
$db = DB::getInstance(
new \Safronik\DB\DBConfig([
'driver' => 'pdo',
'username' => 'root',
'password' => 'root',
'hostname' => 'localhost', // or could be a container name if you are using Docker
])
);
global $some_pdo_connection_object; // should be an instanceof \PDO
$db = DB::getInstance(
new \Safronik\DB\DBConfig([
'driver' => 'pdo',
'connection' => $some_pdo_connection_object,
])
);
global $some_pdo_connection_object; // should be an instanceof \PDO
$db = DB::getInstance(
new \Safronik\DB\DBConfig([
'connection' => $some_pdo_connection_object,
])
);