horde / db
Database abstraction library
v3.0.0alpha7
2026-03-07 00:00 UTC
Requires
- php: ^7.4 || ^8
- horde/date: ^3 || dev-FRAMEWORK_6_0
- horde/exception: ^3 || dev-FRAMEWORK_6_0
- horde/support: ^3 || dev-FRAMEWORK_6_0
- horde/util: ^3 || dev-FRAMEWORK_6_0
Requires (Dev)
- horde/autoloader: ^3 || dev-FRAMEWORK_6_0
- horde/cache: ^3 || dev-FRAMEWORK_6_0
- horde/log: ^3 || dev-FRAMEWORK_6_0
- horde/test: ^3 || dev-FRAMEWORK_6_0
Suggests
- ext-PDO: *
- ext-mysql: *
- ext-mysqli: *
- ext-oci8: *
- horde/autoloader: ^3 || dev-FRAMEWORK_6_0
- horde/cache: ^3 || dev-FRAMEWORK_6_0
- horde/log: ^3 || dev-FRAMEWORK_6_0
- dev-FRAMEWORK_6_0 / 3.x-dev
- v3.0.0alpha7
- v3.0.0alpha6
- v3.0.0alpha5
- v3.0.0alpha4
- v3.0.0alpha3
- 3.0.0alpha2
- 3.0.0alpha1
- 2.4.1
- 2.4.0
- 2.3.4
- 2.3.3
- 2.3.2
- 2.3.1
- 2.3.0
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.5
- 2.1.4
- 2.1.3
- 2.1.2
- 2.1.1
- 2.1.0
- dev-feat/test-coverage-improvements
- dev-TDannhauer-patch-1
- dev-FRAMEWORK_5_2
- dev-master
This package is auto-updated.
Last update: 2026-03-13 13:14:52 UTC
README
Horde_Db
Horde_Db provides database connection abstraction and SQL compatibility tools for a number of database systems and PHP extensions. It currently supports the following databases and extensions:
+-------------+----------+
|Database |Extension |
+-------------+----------+
|MySQL/MariaDB|mysql |
| +----------+
| |mysqli |
| +----------+
| |PDO_mysql |
+-------------+----------+
|PostgreSQL |PDO_pgsql |
+-------------+----------+
|SQLite |PDO_sqlite|
+-------------+----------+
|Oracle |oci8 |
+-------------+----------+
Advanced features include:
- Connection abstraction
- SQL compatibility tools
- Database schema management
- Master/server configuration with queries split to write and read instances
- BLOB/CLOB handling
- Caching
- Query logging
Connection management
Connecting to a database is as simple as instantiating a class implementing the Horde_Db_Adapter interface, providing the necessary connection parameters:
MySQL
Please note that the mysql PHP extension is deprecated as of PHP 7, as is the Horde_Db_Adapter_Mysql backend.
$config = [
'host' => 'localhost',
'username' => 'user',
'password' => 'secret',
'database' => 'db',
];
$db = new Horde_Db_Adapter_Mysqli($config);
$db = new Horde_Db_Adapter_Pdo_Mysql($config);
$db = new Horde_Db_Adapter_Mysql($config);
Full list of connection parameters:
+---------------+---------+--------------------------------------+
|Parameter |Mandatory|Meaning |
+---------------+---------+--------------------------------------+
|charset | |Connection character set |
+---------------+---------+--------------------------------------+
|database/dbname| |Database name |
+---------------+---------+--------------------------------------+
|host | |Host name, if using TCP connection (1)|
+---------------+---------+--------------------------------------+
|port | |Port number, if using TCP connection |
+---------------+---------+--------------------------------------+
|socket | |Socket location, if using Unix sockets|
+---------------+---------+--------------------------------------+
|username |X |Database user |
+---------------+---------+--------------------------------------+
.:1 To workaround MySQL automatically using the unix socket if setting the host to 'localhost', the hostname will be translated from 'localhost' to '127.0.0.1' if using the TCP protocol