PHP code example of hostnet / database-test-lib

1. Go to this page and download the library: Download hostnet/database-test-lib 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/ */

    

hostnet / database-test-lib example snippets



use Doctrine\DBAL\DriverManager;
use Hostnet\Component\DatabaseTest\MysqlPersistentConnection;

$connection = new MysqlPersistentConnection();
$params     = $connection->getConnectionParams();
$doctrine   = DriverManager::getConnection($params);
$statement  = $doctrine->executeQuery('SHOW DATABASES');
$databases  = $statement->fetchAll(\PDO::FETCH_COLUMN);

foreach($databases as $database) {
    echo $database . PHP_EOL;
}