PHP code example of herrera-io / silex-pdo
1. Go to this page and download the library: Download herrera-io/silex-pdo 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/ */
herrera-io / silex-pdo example snippets
use Herrera\Pdo\PdoServiceProvider;
use Silex\Application;
$app = new Application();
$app->register(
new PdoServiceProvider(),
array(
'pdo.dsn' => 'pdo_mysql:dbname=test;host=127.0.0.1',
'pdo.username' => 'username', // optional
'pdo.password' => 'password', // optional
'pdo.options' => array( // optional
PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'"
)
)
);
$pdo = $app['pdo'];
use Herrera\Pdo\PdoTrait;
use Silex\Application;
class MyApp extends Application
{
use PdoTrait;
}