PHP code example of andrew-gos / query-builder
1. Go to this page and download the library: Download andrew-gos/query-builder 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/ */
andrew-gos / query-builder example snippets
use AndrewGos\QueryBuilder\Grammar\DefaultGrammar;
use AndrewGos\QueryBuilder\Query\Select\SelectQuery;
$grammar = new DefaultGrammar();
$query = (new SelectQuery())
->select(['id', 'name', 'email'])
->from(['users'])
->where(['active' => true]);
$built = $grammar->buildSelectQuery($query);
echo $built->sql; // SELECT "id", "name", "email" FROM "users" WHERE "active" IS TRUE
print_r($built->params); // []