use Tsukasa\QueryBuilder\QueryBuilder
require('vendor/autoload.php'); // Composer autoloader
$connection = DriverManager::getConnection([
'dbname' => 'mydb',
'user' => 'user',
'password' => 'secret',
'host' => 'localhost',
'driver' => 'pdo_mysql',
],
$config = new \Doctrine\DBAL\Configuration()
);
$qb = QueryBuilder::getInstance($connection);
$qb->setTypeSelect()
->setSelect('*')
->setFrom('comment')
->setWhere(['id__gte' => 1])
->setOrder(['created_at']);
$connection->fetchAll($qb->toSQL());
// SELECT * FROM comment WHERE id >= 1 ORDER BY created_at ASC