PHP code example of localgod / pdo-service-provider

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

    

localgod / pdo-service-provider example snippets



use PDOException;
use Localgod\Silex\PDOServiceProvider;

try {
    $app->register(new PDOServiceProvider(), array(
    'pdo.connection' => array(
        'driver' => 'mysql',
        'host' => 'localhost',
        'port' => 3306,
        'name' => 'name',
        'user' => 'username',
        'pass' => 'password'
    )));
} catch (PDOException $e) {
    die($e->getMessage());
}