semperton / query
A small and standalone SQL query builder.
1.0.0
2022-06-01 08:38 UTC
Requires
- php: >=7.2
Requires (Dev)
- phpunit/phpunit: ^9.5
- semperton/search: ^0.2.0
- vimeo/psalm: ^4.7
README
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 ;)