1. Go to this page and download the library: Download bitendian/tbp 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/ */
bitendian / tbp example snippets
info()
class MyDomain extends AbstractSqliteDomain
{
public function __construct()
{
$configReader = new Config(__CONFIG_PATH__); // <-- get a config reader, passing your config folder
$config = $configReader->getConfig('my-sqlite'); // <-- read your configuration, passing your config base name
$config->filename = // <-- convert your relative path into absolute path
__BASE_PATH__ .
DIRECTORY_SEPARATOR .
$config->filename;
parent::__construct($config);
$this->open(); // <-- open a db connection and let's rock!
}
public function addRegister($a, $b)
{
$sql = "INSERT INTO `MyTableWithAutoInc` (`a`, `b`) VALUES (?, ?)";
$params = array($a, $b);
return self::insertWithAutoincrement($this->connection->command($sql, $params));
}
public function addAnotherRegister($a, $b)
{
$sql = "INSERT INTO `MyOtherTable` (`a`, `b`) VALUES (?, ?)";
$params = array($a, $b);
return $this->connection->command($sql, $params);
}
public function getRegisters($b)
{
$sql = "SELECT * FROM `MyTableWithAutoInc` WHERE `b` <= ?";
$params = array($b);
return self::getAll($this->connection->select($sql, $params));
}
public function getRegisterById($id)
{
$sql = "SELECT * FROM `MyTableWithAutoInc` WHERE `MyId` = ?";
$params = array($id);
return self::getSingle($this->connection->select($sql, $params));
}
}
$domain = new MyDomain();
$results = $domain->getRegisters(9391); // get an array