PHP code example of andreyors / dsn

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

    

andreyors / dsn example snippets




if (!isset($_ENV['APP_ENV'])) { // Production must have env vars provided via /etc/environment
    (new Symfony\Component\Dotenv\Dotenv())
        ->load(__DIR__ . '/.env');
}

$dsn = \AndreyOrs\Dsn::parse($_ENV['SYNCAPP_URL']);

return [
    'migration_dirs' => [
        'migrations' => __DIR__.'/config/db/migrations',
    ],
    'environments' => [
        'local' => [
            'adapter' => $dsn['adapter'] ?: '',
            'host' => $dsn['host'] ?: '',
            'username' => $dsn['user'] ?: '',
            'password' => $dsn['pass'] ?: '',
            'db_name' => $dsn['name'] ?: '',
            'charset' => 'utf8mb4',
        ],
    ],
];