Latitude is a SQL query builder with zero dependencies and a fluent interface. It supports most of SQL-92 as well as database specific functionality:
use Latitude\QueryBuilder\Engine\CommonEngine; use Latitude\QueryBuilder\QueryFactory; use function Latitude\QueryBuilder\field; $factory = new QueryFactory(new CommonEngine()); $query = $factory ->select('id', 'username') ->from('users') ->where(field('id')->eq(5)) ->compile(); $query->sql(); // SELECT "id" FROM "users" WHERE "id" = ? $query->params(); // 
Latitude includes both a query builder and a powerful set of escaping helpers.
The query builder allows the fluent generation of
DELETE statements. The escaping helpers assist in protecting against SQL
injection and identifier quoting for MySQL, SQL Server, Postgres, and other
databases that follow SQL standards.
Booleans and Nulls
UPDATE queries, boolean and null values will be added directly
the query, rather than as placeholders. This is due to the fact that
PDOStatement::execute($params) will attempt to cast all parameters to strings,
which does not work correctly with booleans or nulls.
for more information.