Skip to content
This repository has been archived by the owner. It is now read-only.
A mix of the original Mongofill extension + BSON implementation in C++
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.

Mongofill for HHVM Build Status

This package provides a drop-in replacement of the official mongodb extension, as a HNI extension to be executed under HHVM runtime

The BSON encode and decode functions are implemented in C++ and the rest of the interface is in pure PHP thanks to Mongofill.

This HNI implementation is 3-5 times faster than the original mongofill extension in pure PHP, too provide a working phpversion("mongo") under HHVM, returning 1.4.5, missed in the original mongofill.

Building and Installation

Installation requires hhvm-dev package to be installed. Alternatively a copy of HHVM can be built from source on the local machine; instructions on how to do this are available on the HHVM Wiki.

The library libbson is required to be installed in the system, you can follow the instructions in the libbson repository.

Once done, the following commands will build the extension.

git clone
cd mongofill-hhvm

This will produce a file, the dynamically-loadable extension.

To enable the extension, you need to have the following section in your hhvm config file

hhvm.dynamic_extension_path = /path/to/hhvm/extensions
hhvm.dynamic_extensions[mongo] =

Supported libraries

You can check the current supported libraries at wiki page Supported-Libraries


You can catch us on IRC on Freenode channel #mongofill


A small suite of benchmarking is included with the mongofill package, you can run the suite with this command:

php ./vendor/bin/athletic -b tests/bootstrap.php  -p tests/Mongofill/Benchmarks/

Some results can be find at:



You can’t perform that action at this time.