PHP code example of rutim / vpdo
1. Go to this page and download the library: Download rutim/vpdo 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/ */
rutim / vpdo example snippets
$xpdoMySQL = \vPDO\vPDO::getInstance('aMySQLDatabase', [
\vPDO\vPDO::OPT_CACHE_PATH => __DIR__ . '/../cache/',
\vPDO\vPDO::OPT_HYDRATE_FIELDS => true,
\vPDO\vPDO::OPT_HYDRATE_RELATED_OBJECTS => true,
\vPDO\vPDO::OPT_HYDRATE_ADHOC_FIELDS => true,
\vPDO\vPDO::OPT_CONNECTIONS => [
[
'dsn' => 'mysql:host=localhost;dbname=xpdotest;charset=utf8',
'username' => 'test',
'password' => 'test',
'options' => [
\vPDO\vPDO::OPT_CONN_MUTABLE => true,
],
'driverOptions' => [],
],
],
]);
$xpdoSQLite = \vPDO\vPDO::getInstance('aSQLiteDatabase', [
\vPDO\vPDO::OPT_CACHE_PATH => __DIR__ . '/../cache/',
\vPDO\vPDO::OPT_HYDRATE_FIELDS => true,
\vPDO\vPDO::OPT_HYDRATE_RELATED_OBJECTS => true,
\vPDO\vPDO::OPT_HYDRATE_ADHOC_FIELDS => true,
\vPDO\vPDO::OPT_CONNECTIONS => [
[
'dsn' => 'sqlite:path/to/a/database',
'username' => '',
'password' => '',
'options' => [
\vPDO\vPDO::OPT_CONN_MUTABLE => true,
],
'driverOptions' => [],
],
],
]);