Skip to content

A lightweight and standalone SQL query builder.

License

Notifications You must be signed in to change notification settings

semperton/query

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Semperton

Semperton Query

A small and standalone SQL query builder.


Installation

Just use Composer:

composer require semperton/query

Query requires PHP 7.2+

Intro

This is a SQL query builder only. All Instances of ExpressionInterface provide a compile method which takes a parameter array by reference and returns a parameter substituted SQL string that can be used with PDO for example.

$queryFactory = new QueryFactory();
$userSelect = $factory->select('user')->limit(5);

$sql = $userSelect->compile($params); // $params is passed by reference

$pdo = new PDO('dsn');
$stm = $pdo->prepare($sql);
$stm->execute($params);
$users = $stm->fetchAll();

// ...

Usage

Use your editor's autocomplete features for now ;)