This library aims to reduce the number of method calls and promote a fast way of building query using Doctrine DBAL wrapper class, without breaking any DBAL implementation. It was inspired by NotORM.
The recommended way to install is through Composer:
composer require abdala/reduce-database
Only set Reduce\Db\Connection as wrapperClass and that's it, you can start use it.
$db = Doctrine\DBAL\DriverManager::getConnection([ 'driver' => 'pdo_sqlite', 'global' => array('memory' => true), 'wrapperClass' => 'Reduce\Db\Connection' ]);
$db->tableName(); //SELECT * FROM tableName
$db->tableName; //SELECT * FROM tableName WHERE id = ?
$db->tableName('name', 'Jose'); //SELECT * FROM tableName WHERE name = ?
$db->tableName('id > ?', 3); //SELECT * FROM tableName WHERE id > ?
$db->tableName([ 'name' => 'Jose', 'id > ?' => 3 ]); //SELECT * FROM tableName WHERE name = ? AND id > ?
To run the test suite, you need Composer and PHPUnit:
Contributions are always welcome, please have a look at our issues to see if there's something you could help with.
Reduce Database is licensed under MIT license.