PHP code example of antidot-fw / dbal-adapter

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

    

antidot-fw / dbal-adapter example snippets




declare(strict_types=1);

$config = [
    'dbal' => [
        'connections' => [
            'default' => [
                'url' => 'mysql://user:secret@localhost/mydb',
            ],
            'other_connection' => [
                'dbname' => 'otherdb',
                'user' => 'user',
                'password' => 'secret',
                'host' => 'localhost',
                'driver' => 'pdo_mysql',
            ],
        ],
    ],
];



declare(strict_types=1);

use Antidot\Persistence\DBAL\Container\DBALConnectionFactory;
use Psr\Container\ContainerInterface;

/** @var ContainerInteface $container */
$container->set('config', $config);
$factory = new DBALConnectionFactory();
$defaultConnection = $factory->__invoke($container);
$theOtherConnection = $factory->__invoke($container, 'other_connection');