Skip to content
Constant database wrapper. This is a mirror from See for contributing.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
build Sync with library bootstrap May 6, 2018
src build: Updating mediawiki/mediawiki-codesniffer to 0.12.0 Sep 4, 2017
.editorconfig Sync with library bootstrap May 6, 2018
.gitattributes Add build/ to .gitattributes May 6, 2018
.gitreview Sync with library bootstrap May 6, 2018
.phpcs.xml Sync with library bootstrap May 6, 2018
.travis.yml Test against php 7.3 in travis Jan 3, 2019 build: Updating mediawiki/mediawiki-codesniffer to 22.0.0 Sep 4, 2018
COPYING Use the plain-text GPL Aug 9, 2015
Doxyfile Sync with library bootstrap May 6, 2018 Make nicer for Doxygen processing Jun 17, 2015

Latest Stable Version License

CDB functions for PHP

CDB, short for "constant database", refers to a very fast and highly reliable database system which uses a simple file with key value pairs. This library wraps the CDB functionality exposed in PHP via the dba_* functions. In cases where dba_* functions are not present or are not compiled with CDB support, a pure-PHP implementation is provided for falling back.

Additional documentation about the library can be found on


// Reading a CDB file
$cdb = \Cdb\Reader::open( 'db.cdb' );
$foo = $cdb->get( 'somekey' );

// Writing to a CDB file
$cdb = \Cdb\Writer::open( 'anotherdb.cdb' );
$cdb->set( 'somekey', $foo );

Running tests

composer install --prefer-dist
composer test


This library was first introduced in MediaWiki 1.16 (r52203). It was split out of the MediaWiki codebase and published as an independent library during the MediaWiki 1.25 development cycle.

You can’t perform that action at this time.