artoodetoo / dbal
DataBase Abstraction Layer
dev-master
2015-02-22 16:12 UTC
Requires
- php: >=5.4.0
Requires (Dev)
- phpunit/phpunit: 4.0.*
This package is auto-updated.
Last update: 2024-12-29 05:04:38 UTC
README
DataBase Abstraction Layer.
Installation
The package can be installed via Composer by requiring the "artoodetoo/dbal" package in your project's composer.json.
{ "require": { "artoodetoo/dbal": "dev-master" } }
Usage
require 'vendor/autoload.php'; use R2\DBAL\PDOMySQL; $db = new PDOMySQL([ 'username' => 'john', 'password' => 'tiger', 'dbname' => 'testdb' ]); $list = $db ->query("SELECT id FROM test") ->fetchAssocAll();
Feature list
Every DBALInterface descendant do:
- named placeholders without ":" sign, so you can do
$db->query($sql, compact('name', 'city', 'ids'))
- array substitution for IN(:ids)
- auto NULL substitution for nulls or empty arrays
- method chaining like
$db ->beginTransaction ->query($insertSql1) ->query($insertSql2) ->query($insertSql3) ->commit();
License
The DBAL is open-source software, licensed under the MIT license