PHP code example of oktopost / squid
1. Go to this page and download the library: Download oktopost/squid 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/ */
oktopost / squid example snippets
$select = $connector->select();
$select
->column('a.*', 'b.Modified')
->from('TableName', 'a')
->leftJoin('AnotherTable', 'b', 'a.ID = b.TableNameID AND b.Status = ?', 'valid')
->byField('b.Name', 'Jhon')
->where('DATE(a.Created) > ?', new \DateTime());
$result = $select->query();
$modifiedAt = $result[0]['Modified'];
use Squid\MySql;
$mysql = new MySql();
$mysql->config()
->addConfig(
'connection_name',
[
'db' => 'db_name',
'host' => 'localhost',
'pass' => 'password',
'user' => 'user_name'
]);
// Aquire new connector object
$connector = $mysql->getConnector('connection_name');
// Aquiring commands
$select = $connector->select();
$insert = $connector->insert();
$delete = $connector->delete();
public function column(...$columns)
$select1->column('a', 'NOW()');
$select2->column('a.a', 'a.b');
public function columns($columns, $table = false)
$select1->columns(['a', 'NOW()']);
$select2->columns(['a', 'b'], 'a');
public function from($table, $alias = false)
$select1->from('Table');
$select2->from('Table', 'a');
public function where($exp, $bind = false)
$select1->where('1 + 1 = ?', 2);
$select2->where('Table.SomeFieldName = ? - ?', [3, 1]);
$delete->where('NOW() > DATE(NOW())');
public function byField($field, $value)
$select1->byField('Name', ['Jhon']);
$select1->byField('ROUND(Price)', [23]);
$select1->byField('ID', [2, 3]);