PHP code example of utopia-php / dsn

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

    

utopia-php / dsn example snippets




= new DSN('mariadb://user:password@localhost:3306/database?charset=utf8&timezone=UTC');
$scheme = $dsn->getScheme(); // mariadb
$user = $dsn->getUser(); // user
$password = $dsn->getPassword(); // password
$host = $dsn->getHost(); // localhost
$port = $dsn->getPort(); // 3306
$path = $dsn->getPath(); // database
$query = $dsn->getQuery(); // charset=utf8&timezone=UTC
$charset = $dsn->getParam('charset') // utf8
$timezone = $dsn->getParam('timezone') // UTC

composer format

# Or if you do not have composer installed
docker run --rm -v $(pwd):$(pwd):rw -w $(pwd) composer  sh -c "composer format"
bash
composer