1. Go to this page and download the library: Download tomkyle/databases 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/ */
tomkyle / databases example snippets
use \tomkyle\Databases\DatabaseConfig;
use \tomkyle\Databases\DatabaseProvider;
// 1a. Describe your database as array:
$describe = array(
'host' => "localhost",
'database' => "database1",
'user' => "root",
'pass' => "secret",
'charset' => "utf8"
);
// 1b. Describe your database as StdClass:
$describe = json_decode('{
"host": "localhost",
"database": "database1"
# etc.
}');
// 2. Setup DatabaseConfig instance:
$config = new DatabaseConfig( $describe );
// 3. Create DatabaseProvider instance:
$factory = new DatabaseProvider( $config );
// 4. Grab Aura.SQL connection:
$aura = $factory->getAuraSql();