Docs Menu
Docs Home
/ / /
PHP Library Manual

Upgrade Library Versions

On this page

  • Overview
  • How to Upgrade
  • Breaking Changes

On this page, you can learn about the changes you must make to your application when you upgrade to a new version of the MongoDB PHP Library. This page also includes how to upgrade your PHP extension to a new version.

Before you upgrade, perform the following actions:

  • Ensure the new PHP library version is compatible with the MongoDB Server versions your application connects to and the PHP version your application compiles with. For version compatibility information, see the MongoDB PHP Library Compatibility page.

  • Address any breaking changes between the library version your application is using and your planned upgrade version in the Breaking Changes section.

Tip

To ensure compatibility across MongoDB Server versions when upgrading library versions, use the Stable API.

Major and minor versions of the PHP extension and library are in sync. This means you can run an upgrade command for the extension to also upgrade the PHP library.

Patch versions (x.x.x) for the library and extension are not in sync. Run the respective commands to update to the patch versions for the library or extension.

To upgrade the PHP extension, replace <version-number> with the version number you want to upgrade to and run the following command in your application's directory:

pecl upgrade mongodb-<version-number>

To upgrade the PHP library version, replace <version-number> with the version number you want to upgrade to and run the following command in your application's directory:

composer require mongodb/mongodb:<version-number>

Detailed installation instructions may be found in the PHP.net documentation.

A breaking change is a change of a convention or a behavior starting in a specific version of the library. This type of change may prevent your application from working properly if not addressed before upgrading the library.

The breaking changes in this section are categorized by the library version that introduced them. When upgrading library versions, address all the breaking changes between the current and upgrade versions.

For more information on release changes, see the release notes and associated JIRA tickets for each release on GitHub.

This library version introduces the following breaking changes:

  • Drops support for MongoDB Server 3.6.

For library versions 1.19 and earlier, see the release notes and associated JIRA tickets for each release on GitHub.

Back

What's New