Note: This project is highly experimental and various parts are non-functional. Please do not even think about using this in production. Development progress is being tracked in the pecl-prototype component of the MongoDB PHP driver's JIRA project.
This repo contains design documentation, examples, and a proof-of-concept implementation of a new MongoDB driver for PHP, Phongo. Unlike the existing driver, this project utilizes libmongoc and libbson.
The purpose of this driver is to provide exceptionally thin glue between MongoDB and PHP, implementing only fundemental and performance-critical components necessary to build a fully-functional MongoDB driver.
In the long run, we hope that userland packages will be built atop this driver to implement various APIs (e.g. a BC layer for the existing driver, new fluent interfaces), management utilities (for creating admit utilities and cluster management applications), and other interesting libraries.
The goal is to encourage community contribution and involvement with these components (with a lower barrier of entry) while also keeping the overall design fast and powerful.
- Model classes (referenced in other examples)
- Querying
- Inserting
- Custom BSON deserialization
The API is developed using normal PHP userland syntax:
The implementation of these objects use CIMPL (Simple) and CEF (Chef) inline code snippets which are then included in the generated C code.
The goal is that this PHP implementation can serve as the canonical implementation of the driver and then used to generate extensions for other PHP implementations (e.g. HHVM).
Ultimately, this extension is not intended to be explicitly installed. Users should choose one (or more) userland PHP libraries that depend on this driver, and install them using Composer. At some point in the future, Composer may support installing extension dependencies.
This project is currently not published as a PECL extension and must be built and installed manually.
To build the driver:
$ phpize
$ ./configure
$ make
To install the driver:
$ make install
To execute the driver's test suite:
$ make test
Some tests depend on userland PHP libraries (e.g. creating data fixtures) and may be skipped if those dependencies are not available. Those libraries may be installed with via Composer:
$ make composer