Generates SQL queries for MySQL and SQLite.
This library helps creating safe SQL queries to use in different plugins.
- PHP 7.4+
- libqlite 3.14+
composer require choval/builderuse choval\builder;
$builder = new builder;
$db = new SQLite3('my.db');
$db->query('CREATE TABLE user ( id INT PRIMARY KEY AUTO_INCREMENT, name TEXT )');
$userId = 1;
$user = $db->querySingle( $builder->get('user', $userId) );
$user['name'] = 'John';
$db->querySingle( $builder->save('user', $user) );loadStructuremethod to load the database structure from a JSON.fieldsmethod for selecting the fields to retrieve. Allow functions as well.orderBymethod for adding an order/sort.groupBymethod to add grouping.havingmethod to filter after grouping.