PHPackages                             torden/php-mdbm - 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. torden/php-mdbm

ActiveLibrary[Database &amp; ORM](/categories/database)

torden/php-mdbm
===============

PHP-mdbm is a PHP binds to the MDBM.

v0.1.2(3y ago)76.0k↓30%2MITCPHP &gt;=5.3.29

Since Jan 23Pushed 3y ago3 watchersCompare

[ Source](https://github.com/torden/php-mdbm)[ Packagist](https://packagist.org/packages/torden/php-mdbm)[ Docs](https://github.com/torden/php-mdbm)[ RSS](/packages/torden-php-mdbm/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)DependenciesVersions (10)Used By (0)

PHP-mdbm
========

[](#php-mdbm)

- PHP-mdbm is a PHP binds to [Yahoo! MDBM C API.](https://github.com/yahoo/mdbm/)
- MDBM is a super-fast memory-mapped key/value store.
- MDBM is an ndbm work-alike hashed database library based on sdbm which is based on Per-Aake Larson’s Dynamic Hashing algorithms.
- MDBM is a high-performance, memory-mapped hash database similar to the homegrown libhash.
- The records stored in a mdbm database may have keys and values of arbitrary and variable lengths.

Build StatsPHP-mdbm ver.LicenseY! mdbm ver.[![Build Status](https://github.com/torden/php-mdbm/actions/workflows/php-mdbm.yml/badge.svg)](https://github.com/torden/php-mdbm/actions)[![GitHub version](https://camo.githubusercontent.com/c4d4e94be96efe8f3da324cf172c2817a9ae0a4298100cd55bf364bf16aed408/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f746f7264656e2f676f2d7374727574696c)](https://github.com/torden/go-strutil)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)[![GitHub version](https://camo.githubusercontent.com/234f4ca449ee76ceaba4d678b384df8b28c1ba7a90f545b36aae0685e44e8563/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f7961686f6f2f6d64626d)](https://github.com/yahoo/mdbm)Table of Contents
-----------------

[](#table-of-contents)

- [API](#api)
- [Install](#install)
- [Example](https://github.com/torden/php-mdbm/blob/master/README.api.md)
- [Benchmark](#benchmark)
- [Link](#link)

API
---

[](#api)

Almost Useful APIs Support.

### Not Supported APIs

[](#not-supported-apis)

Unfortunately, the following list are not supported on now.

GroupAPI[Record Iteration](http://yahoo.github.io/mdbm/api/group__RecordIterationGroup.html)mdbm\_iterate[Data Management](http://yahoo.github.io/mdbm/api/group__DataManagementGroup.html)mdbm\_clean, mdbm\_prune, mdbm\_set\_cleanfunc[Statistics](http://yahoo.github.io/mdbm/api/group__StatisticsGroup.html)mdbm\_chunk\_iterate[Cache and Backing Store](http://yahoo.github.io/mdbm/api/group__CacheAndBackingStoreGroup.html)mdbm\_set\_backingstore[Import and Export](http://yahoo.github.io/mdbm/api/group__ImportExportGroup.html)mdbm\_cdbdump\_to\_file, mdbm\_cdbdump\_trailer\_and\_close, mdbm\_cdbdump\_add\_record, mdbm\_dbdump\_to\_file, mdbm\_dbdump\_trailer\_and\_close, mdbm\_dbdump\_add\_record, mdbm\_dbdump\_export\_header, mdbm\_dbdump\_import\_header, mdbm\_dbdump\_import, mdbm\_cdbdump\_import*If you want them, please feel free to raise an issue*

#### Deprecated APIs

[](#deprecated-apis)

*API**STATUS**COMMENT*mdbm\_saveDEPRECATEDmdbm\_save is only supported for V2 MDBMs.mdbm\_restoreDEPRECATEDmdbm\_restore is only supported for V2 MDBMs.mdbm\_sethashDEPRECATEDLegacy version of mdbm\_set\_hash() This function has inconsistent naming, an error return value. It will be removed in a future version.#### Only a V2 implementation

[](#only-a-v2-implementation)

*API**STATUS**COMMENT*mdbm\_stat\_all\_pageV3 not supportedThere is only a V2 implementation. V3 not currently supported.mdbm\_stat\_headerV3 not supportedThere is only a V2 implementation. V3 not currently supported.Support Two Versions Compatibility
----------------------------------

[](#support-two-versions-compatibility)

### PHP

[](#php)

*Version**Support**Test*5.2.x ~ 5.6.xyesalways7.xyesalways8.xyesalways### MDBM

[](#mdbm)

*branch or release ver.**Support**Test**Comment*masteryesalways4.xyesalwaysInstall
-------

[](#install)

### MDBM

[](#mdbm-1)

- [MDBM Packages](https://github.com/torden/mdbm)

### php-mdbm

[](#php-mdbm-1)

#### Use the composer (packagist)

[](#use-the-composer-packagist)

See the [composer documentation](https://packagist.org/) for use composer

```
composer require torden/php-mdbm
```

#### Use the source code

[](#use-the-source-code)

```
git clone https://github.com/torden/php-mdbm
```

##### Or Download the tarball [(tag or release](https://github.com/torden/php-mdbm/releases))

[](#or-download-the-tarball-tag-or-release)

```
wget https://github.com/torden/php-mdbm/archive/vX.X.X.tar.gz
tar xvzf vX.X.X.tar.gz
```

##### Compile

[](#compile)

```
cd php-mdbm/src/
$PHP_INSTALLED_PATH/bin/phpize
./configure --with-php-config=$PHP_INSTALLED_PATH/bin/php-config --with-mdbm=/usr/local/mdbm/
make
#make test TESTS='-q -m'
#make test TESTS='-q'
make install
```

##### Configuration

[](#configuration)

```
echo "extension=mdbm.so" >> php.ini
```

##### Check

[](#check)

```
$PHP_INSTALLED_PATH/bin/php -i | fgrep -i mdbm
...
mdbm
MDBM Support => enable
MDBM API Version => 4
PHP MDBM Version => 0.1.0
...
```

Example
-------

[](#example)

See the [documentation](https://github.com/torden/php-mdbm/blob/master/README.api.md) for more details.

Benchmark
---------

[](#benchmark)

The following is results of PHP-mdbm vs PHP SQlite3 benchmarks for simple data storing and random fetching.

See the [Source Code](https://github.com/torden/php-mdbm/tree/master/benchmark).

### Prepare for a Benchmark

[](#prepare-for-a-benchmark)

```
cd php-mdbm/src/benchmark/
composer install

```

### Spec

[](#spec)

#### Host

[](#host)

TypeSpecCPUInte i-7RAMDDR4 32GHDDNvme M.2 SSD#### VM

[](#vm)

TypeSpecMachineVM(VirtualBox)OSUbuntu 17.10.1 (Artful Aardvark)CPU2 vCoreRAM8G#### Software

[](#software)

TypeVersionCommentPHP7.0.26---php-mdbmv0.1.0---mdbmmaster branch---SQLite33.19.3Async, Transaction, journal\_mode = wal### Simple INSERTs

[](#simple-inserts)

```
php src/mdbm_simple_store.php -live

```

```
 Created by B. van Hoekelen version 2.3.2 PHP v7.0.26
 Max memory 128M, max execution time unlimited on 2018-01-21 01:33:02

   Label                                                         Time        Memory        Peak
---------------------------------------------------------------------------------------------------
 > Calibrate point                                               2.86 μs |    0.00 KB |    2.00 MB
 > mdbm store(number, number) :: 100,000                       297.88 ms |    0.00 KB |    2.00 MB
 > mdbm store(string, string) :: 100,000                       329.36 ms |    0.00 KB |    2.00 MB
 > mdbm store(number, number) :: 1,000,000                       2.94  s |    0.00 KB |    2.00 MB
 > mdbm store(string, string) :: 1,000,000                       3.36  s |    0.00 KB |    2.00 MB
 > mdbm store(number, number):: 10,000,000                       70.4  s |    0.00 KB |    2.00 MB
 > mdbm store(string, string) :: 10,000,000                    125.46  s |    0.00 KB |    2.00 MB
---------------------------------------------------------------------------------------------------
   Total 7 taken                             01-21 01:36:25    202.78  s      0.00 KB      2.00 MB

```

### Simple Random FETCHs

[](#simple-random-fetchs)

```
php src/mdbm_simple_fetch.php -live

```

```
 Created by B. van Hoekelen version 2.3.2 PHP v7.0.26
 Max memory 128M, max execution time unlimited on 2018-01-21 01:37:49

   Label                                                         Time        Memory        Peak
---------------------------------------------------------------------------------------------------
 > Calibrate point                                               4.05 μs |    0.00 KB |    2.00 MB
 > mdbm random fetch(number) :: 100,000                        140.18 ms |    0.00 KB |    2.00 MB
 > mdbm random fetch(string) :: 100,000                        161.95 ms |    0.00 KB |    2.00 MB
 > mdbm random fetch(number) :: 1,000,000                        1.44  s |    0.00 KB |    2.00 MB
 > mdbm random fetch(string) :: 1,000,000                        1.63  s |    0.00 KB |    2.00 MB
 > mdbm random fetch(number):: 10,000,000                       15.07  s |    0.00 KB |    2.00 MB
 > mdbm random fetch(number) :: 10,000,000                      16.97  s |    0.00 KB |    2.00 MB
---------------------------------------------------------------------------------------------------
   Total 7 taken                             01-21 01:38:24     35.42  s      0.00 KB      2.00 MB

```

### Simple Random FETCHs with Use the Preload API

[](#simple-random-fetchs-with-use-the-preload-api)

```
php src/mdbm_simple_preload_fetch.php -live

```

```
 Created by B. van Hoekelen version 2.3.2 PHP v7.0.26
 Max memory 128M, max execution time unlimited on 2018-01-21 01:39:36

   Label                                                         Time        Memory        Peak
---------------------------------------------------------------------------------------------------
 > Calibrate point                                               4.05 μs |    0.00 KB |    2.00 MB
 > mdbm::preload random fetch(number) :: 100,000               138.52 ms |    0.00 KB |    2.00 MB
 > mdbm::preload random fetch(string) :: 100,000               154.26 ms |    0.00 KB |    2.00 MB
 > mdbm::preload random fetch(number) :: 1,000,000                1.4  s |    0.00 KB |    2.00 MB
 > mdbm::preload random fetch(string) :: 1,000,000               1.58  s |    0.00 KB |    2.00 MB
 > mdbm::preload random fetch(number):: 10,000,000              14.83  s |    0.00 KB |    2.00 MB
 > mdbm::preload random fetch(number) :: 10,000,000             16.73  s |    0.00 KB |    2.00 MB
---------------------------------------------------------------------------------------------------
   Total 7 taken                             01-21 01:40:11     34.83  s      0.00 KB      2.00 MB

```

SQLite3
-------

[](#sqlite3)

### Simple INSERTs

[](#simple-inserts-1)

```
php src/sqlite3_simple_store.php -live

```

```
PRAGMA synchronous=OFF;
pragma journal_mode = wal;
Transaction(BEGIN,COMMIT)

 Created by B. van Hoekelen version 2.3.2 PHP v7.0.26
 Max memory 128M, max execution time unlimited on 2018-01-22 00:44:56

   Label                                                         Time        Memory        Peak
---------------------------------------------------------------------------------------------------
 > Calibrate point                                               4.05 μs |    0.00 KB |    2.00 MB
 > sqlite3 insert(number, number) :: 100,000                    761.78 ms |    0.00 KB |    2.00 MB
 > sqlite3 insert(string, string) :: 100,000                      1.17  s |    0.00 KB |    2.00 MB
 > sqlite3 insert(number, number) :: 1,000,000                    7.93  s |    0.00 KB |    2.00 MB
 > sqlite3 insert(string, string) :: 1,000,000                   12.29  s |    0.00 KB |    2.00 MB
 > sqlite3 insert(number, number):: 10,000,000                   80.24  s |    0.00 KB |    2.00 MB
 > sqlite3 insert(string, string) :: 10,000,000                 127.54  s |    0.00 KB |    2.00 MB
---------------------------------------------------------------------------------------------------
   Total 7 taken                             01-22 01:00:25    229.93  s      0.00 KB      2.00 MB

```

### Simple Random FETCHs

[](#simple-random-fetchs-1)

```
php src/sqlite3_simple_fetch.php -live

```

```
PRAGMA synchronous=OFF;
pragma journal_mode = wal;

 Created by B. van Hoekelen version 2.3.2 PHP v7.0.26
 Max memory 128M, max execution time unlimited on 2018-01-22 01:23:53

   Label                                                         Time        Memory        Peak
---------------------------------------------------------------------------------------------------
 > Calibrate point                                               4.05 μs |    0.00 KB |    2.00 MB
 > sqlite3 random fetch(number) :: 100,000                       2.16  s |    0.00 KB |    2.00 MB
 > sqlite3 random fetch(string) :: 100,000                       3.16  s |    0.00 KB |    2.00 MB
 > sqlite3 random fetch(number) :: 1,000,000                    25.94  s |    0.00 KB |    2.00 MB
 > sqlite3 random fetch(string) :: 1,000,000                    34.84  s |    0.00 KB |    2.00 MB
 > sqlite3 random fetch(number):: 10,000,000                   275.47  s |    0.00 KB |    2.00 MB
 > sqlite3 random fetch(string) :: 10,000,000                  397.42  s |    0.00 KB |    2.00 MB
---------------------------------------------------------------------------------------------------
   Total 7 taken                             01-22 01:36:12    738.99  s      0.00 KB      2.00 MB

```

Link
----

[](#link)

- [Yahoo! MDBM](https://github.com/yahoo/mdbm)
- [MDBM::Concept](http://yahoo.github.io/mdbm/guide/concepts.html)
- [MDBM::Build](https://github.com/yahoo/mdbm/blob/master/README.build)
- [MDBM::Document](http://yahoo.github.io/mdbm/)
- [MDBM::FAQ](http://yahoo.github.io/mdbm/guide/faq.html)
- [DBM](https://en.wikipedia.org/wiki/Dbm)
- [MDBM::Macro(const)](http://yahoo.github.io/mdbm/api/mdbm_8h.html)
- [Packagist](https://packagist.org/packages/torden/php-mdbm)
- [MDBM Packages](https://github.com/torden/mdbm)
- [Go-mdbm](https://github.com/torden/go-mdbm)
- [Py-mdbm](https://github.com/torden/py-mdbm)
- [Upgrading PHP extensions from PHP5 to NG](https://wiki.php.net/phpng-upgrading)

---

*Please feel free. I hope it is helpful for you.*

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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 ~840 days

Total

3

Last Release

1356d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1ca380516602057048c745eaee764d710366ebe63e78097d27b28fc6ecb4f563?d=identicon)[torden](/maintainers/torden)

---

Top Contributors

[![torden](https://avatars.githubusercontent.com/u/3272513?v=4)](https://github.com/torden "torden (52 commits)")

---

Tags

databasedbmkey-valuemdbmphpphp-mdbmphpmdbmdatabasenosqlhashtableDBMmdbm

### Embed Badge

![Health badge](/badges/torden-php-mdbm/health.svg)

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

###  Alternatives

[datastax/php-driver

DataStax PHP Driver for Apache Cassandra

437521.5k19](/packages/datastax-php-driver)[triagens/arangodb

ArangoDB PHP client

186189.4k19](/packages/triagens-arangodb)[basho/riak

Official Riak client for PHP

159246.7k7](/packages/basho-riak)[tbolier/php-rethink-ql

A clean and solid RethinkDB driver for PHP.

5211.7k](/packages/tbolier-php-rethink-ql)[cubettech/lacassa

Cassandra based query builder for laravel.

358.5k](/packages/cubettech-lacassa)[mroosz/php-cassandra

A pure-PHP client for Apache Cassandra and ScyllaDB with support for CQL binary protocol v3, v4 and v5 (Cassandra 2.1+ incl. 3.x-5.x; ScyllaDB 6.2 and 2025.x), synchronous and asynchronous APIs, prepared statements, batches, result iterators, object mapping, SSL/TLS, and LZ4 compression.

205.6k2](/packages/mroosz-php-cassandra)

PHPackages © 2026

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