1. Go to this page and download the library: Download openclerk/db 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/ */
openclerk / db example snippets
use \Openclerk\Config;
function db() {
return new \Db\SoloConnection(
Config::get("database_name"),
Config::get("database_username"),
Config::get("database_password")
);
}
$logger = new \Monolog\Logger('name');
class AllMigrations extends \Db\Migration {
function getParents() {
return array(new Db\BaseMigration()) + DiscoveredComponents\Migrations::getAllInstances();
}
}
$migrations = new AllMigrations(db());
if ($migrations->hasPending(db())) {
$migrations->install(db(), $logger);
}
function db() {
return new \Db\ReplicatedConnection(
Config::get("database_host_master"),
Config::get("database_host_slave"),
Config::get("database_name"),
Config::get("database_username"),
Config::get("database_password")
);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.