PHP code example of mikeweb85 / dsn

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

    

mikeweb85 / dsn example snippets


$dsn = new DSN('mysql://root:[email protected]:3306/test_db/test_table');

$dsn->isValid();      // true
$dsn->getProtocol();  // 'mysql'
$dsn->getUsername();  // 'root'
$dsn->getPassword();  // 'root_pass'
$dsn->getFirstHost(); // '127.0.0.1'
$dsn->getFirstPort(); // 3306
$dsn->getDatabase();  // 'test_db'
$dsn->getTable();  // 'test_table'