MySQL query builder PHP class

DSQL - Query Builder for PHP is exactly what you're looking for, no dependencies and has MIT license:

$query = new atk4\dsql\Query();
$query  ->table('employees')
    ->where('birth_date','1961-05-02')
    ->field('count(*)')
    ;
echo "Employees born on May 2, 1961: ".$query->getOne();

https://github.com/atk4/dsql

Documentation: http://dsql.readthedocs.io/


Finally I took Doctrine ORM

and modified it little bit to build SQL instead of DQL.

This works very nice and it able to construct complex queries.

Edit: You can find my final stable implementation in Stingle framework. Look at Db/QueryBuilder plugin.

Tags:

Mysql

Php

Oop

Class