Fetching contributors…
Cannot retrieve contributors at this time
63 lines (44 sloc) 2.19 KB

Contributing to the PHP Driver for MongoDB

Building from VCS (GitHub)

Developers who would like to contribute to the driver will need to build it from VCS like so:

$ git clone phongo
$ cd phongo
$ git submodule update --init
$ phpize
$ ./configure --enable-developer-flags
$ make -j8 all


The test suites expects to find PHONGO-SERVERS.json in the system temp directory (typically /tmp). This file should contain JSON object with MONGODB URIs, similar to the following template

    "STANDALONE": "mongodb:\/\/",
    "STANDALONE_SSL": "mongodb:\/\/",
    "STANDALONE_AUTH": "mongodb:\/\/root:toor@\/?authSource=admin",
    "STANDALONE_X509": "mongodb:\/\/C=US,ST=New York,L=New York City,O=MongoDB,OU=KernelUser,CN=client@\/?authSource=$external&authMechanism=MONGODB-X509",
    "STANDALONE_PLAIN": "mongodb:\/\/root:toor@\/?authSource=admin",
    "REPLICASET": "mongodb:\/\/,,\/?replicaSet=REPLICASET"

The location of this PHONGO-SERVERS.json file can be configured by exporting PHONGO_SERVERS environment variable with a absolute path to the json configuration file.

Alternatively, we provide, and use, Vagrant to spin up handful of VMs where we setup and configure MongoDB according to our needs. This is the preferred way of creating PHONGO-SERVERS.json and running the test suite.

$ make vm # requires vagrant (
$ make test-bootstrap # Spins up mongod's in the virtual machines

The test-bootstrap make target will then generate the required PHONGO-SERVERS.json.

To execute the test suite:

$ make test # Executes the test suite against the virtual machines

The bundled Vagrantfile also contains few other (growing) list of VMs that can be provisioned to execute the test suite on various platforms.

These are automatically executed by the make distcheck, which will package a new PECL archive, spin up the various operating systems, install the newly packaged archive, and execute the test suite.