Skip to content

lytc/mysql-query-builder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

THIS PROJECT DOESN'T MAINTAIN ANYMORE

I'M RECOMMEND TO USE LAZY FRAMEWORK.

YOU COULD YOU LAZY FRAMEWORK - QUERY BUIDER PART INSTEAD.

MySQL Query Builder

$select = new Qb\Select;
$select->from('foo f')
  ->innerJoin('bar b', 'b.foo_id = f.id')
  ->where('f.id IN(?)', [1, 2, 3]);
echo $select; // SELECT * FROM `foo` `f` INNER JOIN `bar` `b` ON b.foo_id = f.id WHERE f.id IN(1, 2, 3)
$insert = new Qb\Insert;
$insert->into('foo')->value(['bar' => 1, 'baz' => 2]);
echo $insert; // INSERT `foo`(`bar`, `baz`) VALUES (1, 2)
$update = new Qb\Update;
$update->from('foo')->value(['bar' => 1, 'baz' => 2])->where('id = ?', 1);
echo $update; // UPDATE `foo` SET `bar` = 1, `baz` = 2 WHERE id = 1
$delete = new Qb\Delete;
$delete->from('foo')->where('id > ? AND id < ?', 2, 4)->limit(5);
echo $delete; // DELETE FROM `foo` WHERE id > 2 AND id < 4 LIMIT 5

About

A lightweight PHP 5.4 fluent query builder library for MySQL

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages