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