Skip to content

jameslcj/mongo-php-driver-prototype

 
 

Repository files navigation

pecl/mongodb (MongoDB driver for PHP)

Build Status Coverage Status

The purpose of this driver is to provide a thin glue between MongoDB and PHP, implementing only fundamental and performance-critical components

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 admin 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.

Documentation

Installation

To build and install the driver:

$ pecl install mongodb-alpha
$ echo "extension=mongodb.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`

We recommend using this extension in conjunction with our userland library, which is distributed as mongodb/mongodb for Composer.

Contributing

See CONTRIBUTING.md

Testing

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:\/\/192.168.112.10:2000",
    "STANDALONE_SSL": "mongodb:\/\/192.168.112.10:2100",
    "STANDALONE_AUTH": "mongodb:\/\/root:toor@192.168.112.10:2200\/?authSource=admin",
    "STANDALONE_X509": "mongodb:\/\/C=US,ST=New York,L=New York City,O=MongoDB,OU=KernelUser,CN=client@192.168.112.10:2300\/?authSource=$external&authMechanism=MONGODB-X509",
    "STANDALONE_PLAIN": "mongodb:\/\/root:toor@192.168.112.10:2400\/?authSource=admin",
    "REPLICASET": "mongodb:\/\/192.168.112.10:3000,192.168.112.10:3001,192.168.112.10:3002\/?replicaSet=REPLICASET"
}

Alternatively, we provide, and use, Vagrant to spin up couple of VMs where we setup and configure MongoDB according to our needs.

$ make vm # requires vagrant (www.vagrantup.com)
$ 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.

Related projects

About

MongoDB PHP driver (experimental)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 49.9%
  • PHP 44.3%
  • Roff 4.0%
  • Shell 0.8%
  • JavaScript 0.6%
  • Python 0.3%
  • Batchfile 0.1%