PHP code example of heropoo / db

1. Go to this page and download the library: Download heropoo/db 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/ */

    

heropoo / db example snippets



// get a connection

$config = [
    'dsn'=>'mysql:host=localhost;dbname=test',
    'username'=>'root',
    'password'=>'root'
];
$db = new Moon\Db\Connection($config);

//get pdo instance
try{
    $db->getPdo();
}catch (PDOException $e){
    echo $e->getMessage();