The PHP team is happy to announce that version 1.17.0 of of the MongoDB PHP library is now available.
This release introduces a new “codec” API for converting BSON to and from PHP objects. Although this feature is implemented entirely in the library, it leverages the extension’s MongoDB\BSON\Document object to work with raw BSON and lazily decode it as necessary. Unlike the extension’s MongoDB\BSON\Serializable and MongoDB\BSON\Unserializable interfaces, codecs allow an application to separate the business logic in a PHP object representing a document from the logic necessary to convert it to/from BSON. To support this feature, a new
codec option has been introduced on most classes and methods that currently accept a
typeMap option; both options are mutually exclusive. More information on this feature may be found in the Codecs tutorial.
In conjunction with the MongoDB\Driver\Monitoring\LogSubscriber interface introduced in the corresponding extension version, MongoDB\add_logger() and MongoDB\remove_logger() functions have been introduced in the library. These functions allow applications to register a PSR-3 Logger to receive log messages emitted by the driver. Previously, logs were only accessible via the extension’s
mongodb.debug INI setting.
Several new MongoDB\Collection methods were introduced to create and manage Atlas Search indexes. Atlas Search indexes can be queried using the
$search aggregation pipeline stage, which is supported in all versions of the library.
This release upgrades the
mongodb extension requirement to 1.17.0. Support for PHP 7.2 and 7.3 has been removed and the library now requires PHP 7.4 or newer.
A complete list of resolved issues in this release may be found in JIRA.
Documentation for this library may be found in the PHP Library Manual.
This library may be installed or upgraded with:
composer require mongodb/mongodb:1.17.0
Installation instructions for the
mongodb extension may be found in the PHP.net documentation.
Thanks to our community contributors for 1.17.0: