PHPackages                             mongodb/mongodb - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. mongodb/mongodb

ActiveLibrary[Database &amp; ORM](/categories/database)

mongodb/mongodb
===============

MongoDB driver library

2.2.0(3mo ago)1.6k64.0M—9%263[5 PRs](https://github.com/mongodb/mongo-php-library/pulls)20Apache-2.0PHPPHP ^8.1CI passing

Since Dec 12Pushed today69 watchersCompare

[ Source](https://github.com/mongodb/mongo-php-library)[ Packagist](https://packagist.org/packages/mongodb/mongodb)[ Docs](https://jira.mongodb.org/browse/PHPLIB)[ RSS](/packages/mongodb-mongodb/feed)WikiDiscussions v2.x Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (92)Used By (20)Security (1)

MongoDB PHP Library
===================

[](#mongodb-php-library)

[![Tests](https://github.com/mongodb/mongo-php-library/actions/workflows/tests.yml/badge.svg)](https://github.com/mongodb/mongo-php-library/actions/workflows/tests.yml/badge.svg)[![Coding Standards](https://github.com/mongodb/mongo-php-library/actions/workflows/coding-standards.yml/badge.svg)](https://github.com/mongodb/mongo-php-library/actions/workflows/coding-standards.yml/badge.svg)

This library provides a high-level abstraction around the lower-level [PHP driver](https://github.com/mongodb/mongo-php-driver) (`mongodb` extension).

While the extension provides a limited API for executing commands, queries, and write operations, this library implements a full-featured API similar to that of other MongoDB drivers. It contains abstractions for client, database, and collection objects, and provides methods for CRUD operations and common commands (e.g. index and collection management).

If you are developing an application with MongoDB, you should consider using this library, or another high-level abstraction, instead of the extension alone.

Additional information about the architecture of this library and the `mongodb`extension may be found in [Architecture Overview](https://php.net/manual/en/mongodb.overview.php).

Documentation
-------------

[](#documentation)

-
-

Installation
------------

[](#installation)

The preferred method of installing this library is with [Composer](https://getcomposer.org/) by running the following from your project root:

```
$ composer require mongodb/mongodb

```

Additional installation instructions may be found in the [library documentation](https://mongodb.com/docs/php-library/current/tutorial/install-php-library/).

Since this library is a high-level abstraction for the driver, it also requires that the `mongodb` extension be installed:

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

```

Additional installation instructions for the extension may be found in its [PHP.net documentation](https://php.net/manual/en/mongodb.installation.php).

Release Integrity
-----------------

[](#release-integrity)

Releases are created automatically and the resulting release tag is signed using the [PHP team's GPG key](https://pgp.mongodb.com/php-driver.asc). To verify the tag signature, download the key and import it using `gpg`:

```
gpg --import php-driver.asc
```

Then, in a local clone, verify the signature of a given tag (e.g. `1.19.0`):

```
git show --show-signature 1.19.0
```

Note

Composer does not support verifying signatures as part of its installation process.

Reporting Issues
----------------

[](#reporting-issues)

Issues pertaining to the library should be reported in the [PHPLIB](https://jira.mongodb.org/secure/CreateIssue!default.jspa?project-field=PHPLIB)project in MongoDB's JIRA. Extension-related issues should be reported in the [PHPC](https://jira.mongodb.org/secure/CreateIssue!default.jspa?project-field=PHPC)project.

For general questions and support requests, please use one of MongoDB's [Technical Support](https://mongodb.com/docs/manual/support/) channels.

### Security Vulnerabilities

[](#security-vulnerabilities)

If you've identified a security vulnerability in a driver or any other MongoDB project, please report it according to the instructions in [Create a Vulnerability Report](https://mongodb.com/docs/manual/tutorial/create-a-vulnerability-report).

Development
-----------

[](#development)

Development is tracked in the [PHPLIB](https://jira.mongodb.org/projects/PHPLIB/summary) project in MongoDB's JIRA. Documentation for contributing to this project may be found in [CONTRIBUTING.md](CONTRIBUTING.md).

###  Health Score

82

—

ExcellentBetter than 100% of packages

Maintenance92

Actively maintained with recent releases

Popularity78

Solid adoption and visibility

Community61

Healthy contributor diversity

Maturity88

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~46 days

Recently: every ~12 days

Total

89

Last Release

53d ago

Major Versions

0.2.0 → 1.0.0-alpha12015-10-07

1.21.1 → 2.0.02025-04-10

1.21.2 → 2.1.12025-08-13

1.21.3 → 2.1.22025-10-06

v1.21.x-dev → v2.2.x-dev2026-03-10

PHP version history (9 changes)1.0.0-alpha1PHP &gt;=5.4

1.2.0PHP &gt;=5.5

1.5.0PHP ^5.6 || ^7.0

1.7.0-beta1PHP ^7.0

1.8.0-RC1PHP ^7.0 || ^8.0

1.9.0PHP ^7.1 || ^8.0

1.11.0PHP ^7.2 || ^8.0

1.17.0PHP ^7.4 || ^8.0

1.21.0PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/400034?v=4)[Jérôme Tamarelle](/maintainers/GromNaN)[@GromNaN](https://github.com/GromNaN)

![](https://avatars.githubusercontent.com/u/383198?v=4)[Andreas Braun](/maintainers/alcaeus)[@alcaeus](https://github.com/alcaeus)

![](https://avatars.githubusercontent.com/u/555869?v=4)[Alexander Vos](/maintainers/vos)[@vos](https://github.com/vos)

---

Top Contributors

[![jmikola](https://avatars.githubusercontent.com/u/244663?v=4)](https://github.com/jmikola "jmikola (1433 commits)")[![alcaeus](https://avatars.githubusercontent.com/u/383198?v=4)](https://github.com/alcaeus "alcaeus (578 commits)")[![GromNaN](https://avatars.githubusercontent.com/u/400034?v=4)](https://github.com/GromNaN "GromNaN (229 commits)")[![mongodb-php-bot](https://avatars.githubusercontent.com/u/162451593?v=4)](https://github.com/mongodb-php-bot "mongodb-php-bot (164 commits)")[![kvwalker](https://avatars.githubusercontent.com/u/7121013?v=4)](https://github.com/kvwalker "kvwalker (126 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (113 commits)")[![bjori](https://avatars.githubusercontent.com/u/72407?v=4)](https://github.com/bjori "bjori (66 commits)")[![derickr](https://avatars.githubusercontent.com/u/208074?v=4)](https://github.com/derickr "derickr (48 commits)")[![aleksandr-rudo](https://avatars.githubusercontent.com/u/100972841?v=4)](https://github.com/aleksandr-rudo "aleksandr-rudo (20 commits)")[![paulinevos](https://avatars.githubusercontent.com/u/5345273?v=4)](https://github.com/paulinevos "paulinevos (17 commits)")[![OskarStark](https://avatars.githubusercontent.com/u/995707?v=4)](https://github.com/OskarStark "OskarStark (17 commits)")[![norareidy](https://avatars.githubusercontent.com/u/107268623?v=4)](https://github.com/norareidy "norareidy (10 commits)")[![levon80999](https://avatars.githubusercontent.com/u/70570610?v=4)](https://github.com/levon80999 "levon80999 (9 commits)")[![schmalliso](https://avatars.githubusercontent.com/u/1724699?v=4)](https://github.com/schmalliso "schmalliso (4 commits)")[![carusogabriel](https://avatars.githubusercontent.com/u/16328050?v=4)](https://github.com/carusogabriel "carusogabriel (4 commits)")[![mlaopane](https://avatars.githubusercontent.com/u/23735276?v=4)](https://github.com/mlaopane "mlaopane (3 commits)")[![tanlisu](https://avatars.githubusercontent.com/u/46271307?v=4)](https://github.com/tanlisu "tanlisu (3 commits)")[![tuyakhov](https://avatars.githubusercontent.com/u/7713205?v=4)](https://github.com/tuyakhov "tuyakhov (2 commits)")[![corpsee](https://avatars.githubusercontent.com/u/1416706?v=4)](https://github.com/corpsee "corpsee (2 commits)")[![remicollet](https://avatars.githubusercontent.com/u/270445?v=4)](https://github.com/remicollet "remicollet (2 commits)")

---

Tags

mongodbmongodb-driverphppersistencedatabasemongodbdriver

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm, Rector

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/mongodb-mongodb/health.svg)

```
[![Health](https://phpackages.com/badges/mongodb-mongodb/health.svg)](https://phpackages.com/packages/mongodb-mongodb)
```

###  Alternatives

[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k7.2M71](/packages/mongodb-laravel-mongodb)[doctrine/mongodb-odm-bundle

Symfony Doctrine MongoDB Bundle

38418.7M195](/packages/doctrine-mongodb-odm-bundle)[mongodb/mongodb-extension

MongoDB driver extension

91919.8k](/packages/mongodb-mongodb-extension)[perplorm/perpl

Perpl is an improved and still maintained fork of Propel2, an open-source Object-Relational Mapping (ORM) for PHP.

203.7k](/packages/perplorm-perpl)[bartlett/php-compatinfo-db

Reference Database of all functions, constants, classes, interfaces on PHP standard distribution and about 110 extensions

1183.0k1](/packages/bartlett-php-compatinfo-db)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
