, (*1)
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., (*2)
Instalation
The recommended way to install is through Composer:, (*3)
composer require abdala/reduce-database
Usage
Only set Reduce\Db\Connection as wrapperClass and that's it, you can start use it., (*4)
$db = Doctrine\DBAL\DriverManager::getConnection([
'driver' => 'pdo_sqlite',
'global' => array('memory' => true),
'wrapperClass' => 'Reduce\Db\Connection'
]);
Select
$db->tableName(); //SELECT * FROM tableName
Where
$db->tableName[3]; //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 > ?
Tests
To run the test suite, you need Composer and PHPUnit:, (*5)
./vendor/bin/phpunit
Contributing
Contributions are always welcome, please have a look at our issues to see if there's something you could help with., (*6)
License
Reduce Database is licensed under MIT license., (*7)