PHPackages                             cdb/cdb - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. cdb/cdb

Abandoned → [wikimedia/cdb](/?search=wikimedia%2Fcdb)Library[Database &amp; ORM](/categories/database)

cdb/cdb
=======

Constant Database (CDB) wrapper library for PHP. Provides pure-PHP fallback when dba\_\* functions are absent.

3.0.0(2y ago)143.2k8GPL-2.0-or-laterPHPPHP &gt;=7.4.0

Since Nov 12Pushed 2mo ago13 watchersCompare

[ Source](https://github.com/wikimedia/cdb)[ Packagist](https://packagist.org/packages/cdb/cdb)[ Docs](https://www.mediawiki.org/wiki/CDB)[ RSS](/packages/cdb-cdb/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (7)Versions (11)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/7c8ba9d2809c78b65c5101bfb7780592566f40b2b4567a23f1bb07ae29060660/68747470733a2f2f706f7365722e707567782e6f72672f77696b696d656469612f6364622f762f737461626c652e737667)](https://packagist.org/packages/wikimedia/cdb) [![License](https://camo.githubusercontent.com/376b2605b1bc2dc9a265ee2350bd7126be87221951537f060d2880eb58aea7de/68747470733a2f2f706f7365722e707567782e6f72672f77696b696d656469612f6364622f6c6963656e73652e737667)](https://packagist.org/packages/wikimedia/cdb)

CDB functions for PHP
=====================

[](#cdb-functions-for-php)

[CDB](https://en.wikipedia.org/wiki/cdb_(software)), 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 [mediawiki.org](https://www.mediawiki.org/wiki/CDB).

Usage
-----

[](#usage)

```
// 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 );
```

```
// Using the CLI
$ cdb ./myfile.cdb [get|list|match]

```

Running tests
-------------

[](#running-tests)

```
composer install --prefer-dist
composer test

```

History
-------

[](#history)

This library was first introduced in [MediaWiki 1.16](https://www.mediawiki.org/wiki/MediaWiki_1.16) ([r52203](https://www.mediawiki.org/wiki/Special:Code/MediaWiki/52203)). It was split out of the MediaWiki codebase and published as an independent library during the [MediaWiki 1.25](https://www.mediawiki.org/wiki/MediaWiki_1.25) development cycle.

---

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance58

Moderate activity, may be stable

Popularity28

Limited adoption so far

Community25

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor3

3 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~352 days

Recently: every ~659 days

Total

10

Last Release

1024d ago

Major Versions

1.4.1 → 2.0.02021-12-21

2.1.0 → 3.0.02023-07-24

PHP version history (3 changes)1.0.0PHP &gt;=5.3.2

2.0.0PHP &gt;=7.2.9

2.1.0PHP &gt;=7.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/b94d9718c06ec7c3fd7a104bc44966fb7464b9ec7411582343ea35a7a6a85f08?d=identicon)[mediawiki](/maintainers/mediawiki)

![](https://www.gravatar.com/avatar/716c86d71cbf921e7912a505f89d799de398fc0a3af0bd4c8862834b2d642bd7?d=identicon)[wikimedia](/maintainers/wikimedia)

---

Top Contributors

[![legoktm](https://avatars.githubusercontent.com/u/81392?v=4)](https://github.com/legoktm "legoktm (20 commits)")[![Krinkle](https://avatars.githubusercontent.com/u/156867?v=4)](https://github.com/Krinkle "Krinkle (20 commits)")[![jdforrester](https://avatars.githubusercontent.com/u/881572?v=4)](https://github.com/jdforrester "jdforrester (11 commits)")[![umherirrender](https://avatars.githubusercontent.com/u/1174884?v=4)](https://github.com/umherirrender "umherirrender (10 commits)")[![bd808](https://avatars.githubusercontent.com/u/6469?v=4)](https://github.com/bd808 "bd808 (7 commits)")[![atdt](https://avatars.githubusercontent.com/u/376462?v=4)](https://github.com/atdt "atdt (6 commits)")[![hashar](https://avatars.githubusercontent.com/u/281689?v=4)](https://github.com/hashar "hashar (5 commits)")[![reedy](https://avatars.githubusercontent.com/u/67615?v=4)](https://github.com/reedy "reedy (4 commits)")[![thiemowmde](https://avatars.githubusercontent.com/u/6576639?v=4)](https://github.com/thiemowmde "thiemowmde (4 commits)")[![ricordisamoa](https://avatars.githubusercontent.com/u/4588496?v=4)](https://github.com/ricordisamoa "ricordisamoa (2 commits)")[![DannyS712](https://avatars.githubusercontent.com/u/46829944?v=4)](https://github.com/DannyS712 "DannyS712 (2 commits)")[![paladox](https://avatars.githubusercontent.com/u/5727000?v=4)](https://github.com/paladox "paladox (2 commits)")[![Daimona](https://avatars.githubusercontent.com/u/38216014?v=4)](https://github.com/Daimona "Daimona (1 commits)")[![xSavitar](https://avatars.githubusercontent.com/u/4872561?v=4)](https://github.com/xSavitar "xSavitar (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cdb-cdb/health.svg)

```
[![Health](https://phpackages.com/badges/cdb-cdb/health.svg)](https://phpackages.com/packages/cdb-cdb)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
