Skip to content

1.0.0

Compare
Choose a tag to compare
@jmikola jmikola released this 25 Jan 15:27

The PHP team is happy to announce that version 1.0.0 of our MongoDB PHP library is now available. This library is a high-level abstraction for the PHP 5, PHP 7, and HHVM drivers (i.e. mongodb extension).

Release Highlights

This library provides Client, Database, and Collection classes, each of which contains helper methods for their context. For instance, the Client class may be constructed with a MongoDB connection URI and serve as the gateway for selecting Database and Collection classes; the Database class may be used to create and drop collections or execute arbitrary commands; the Collection class contains a suite of CRUD operations and index management methods. These classes are analogous to the MongoClient, MongoDB, and MongoCollection classes found in the legacy mongo extension; however, the APIs are not identical.

This library implements the following MongoDB cross-driver specifications:

Starting with version 1.0.0 of the library, BSON documents and arrays are unserialized as MongoDB\Model\BSONDocument and MongoDB\Model\BSONArray classes by default (this may be customized via the typeMap option on any of the core classes). These model classes implement the MongoDB\BSON\Serializable and MongoDB\BSON\Unserializable interfaces found in the new driver, which the library uses to ensure that each class is properly serialized back to its original BSON type. This eliminates a caveat of the legacy driver where BSON arrays might turn into objects, and vice versa. Additionally, the new model classes extend PHP's ArrayObject class for usability (e.g. documents and arrays support element access via [] and the document class may also use ->).

A complete list of resolved issues in this release may be found at:
https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=12483&version=15987

Documentation

Documentation for this library may be found at:
http://mongodb.github.io/mongo-php-library/

Generated API reference for this library may be found at:
http://mongodb.github.io/mongo-php-library/api/

Feedback

If you encounter any bugs or issues with this library, please report them via this form:
https://jira.mongodb.org/secure/CreateIssue.jspa?pid=12483&issuetype=1

Installation

This library may be installed or upgraded with:

composer require "mongodb/mongodb=^1.0.0"

The MongoDB PHP driver may be installed or upgraded with:

pecl install mongodb
pecl upgrade mongodb

Installation Instructions for the HHVM driver may be found in the PHP.net documentation.