Doctrine DBAL Connection Wrapper
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests
.gitignore
.scrutinizer.yml
.travis.yml
LICENSE
README.md
composer.json
phpunit.xml.dist

README.md

Build Status Scrutinizer Code Quality

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.

Instalation

The recommended way to install is through Composer:

composer require abdala/reduce-database

Usage

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'
]);

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:

./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.

License

Reduce Database is licensed under MIT license.