For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.
Docs Menu

PHP Libraries, Frameworks, and Tools

The PHP ecosystem offers several ways to work with MongoDB beyond the core driver. When selecting a library or framework integration, consider the following guidelines:

  • To use MongoDB in a Laravel application, use the official Laravel MongoDB integration.

  • To map PHP objects to MongoDB documents with additional features such as relationships, a document manager that persists changes in bulk, and an event system, use Doctrine MongoDB ODM.

  • To integrate MongoDB with a PHP web framework, choose an integration from the Web Framework Integrations section.

  • To address specific needs such as caching, messaging, and profiling, choose a tool from the Application Tools section.

Note

Community Maintenance

Except when noted, the libraries and tools on this page are maintained by the community, not by MongoDB. Before using a library, review its repository to confirm it's actively maintained and compatible with your MongoDB and PHP versions.

Use the following general purpose libraries and object-document mappers (ODMs) to map PHP objects to MongoDB documents:

ODM
Description
Learn More

Laravel MongoDB

MongoDB maintains this official integration for Laravel, which lets you use Laravel Eloquent and Query Builder syntax to store and retrieve MongoDB data.

Laravel MongoDB documentation

Doctrine MongoDB ODM

MongoDB maintains this ODM, which adds higher-level features such as relationships, a document manager that persists changes in bulk, and an event system. You can use the standalone library or integrate it with Symfony or Laminas (formerly Zend Framework).

Doctrine MongoDB ODM documentation

Mongolid

This community-maintained ODM implements the ActiveRecord and DataMapper design patterns and supports embedded and referenced documents. You can use the standalone library or integrate it with Laravel.

Mongolid documentation

Xenus

This community-maintained ODM supports events, relationships, and embedded documents. You can use the standalone library or integrate it with Laravel.
IMPORTANT: This project is not actively maintained, and the last release was in 2023.

Xenus documentation

Use the following integrations to integrate MongoDB in PHP web frameworks:

Web Framework
Description
Learn More

Drupal

A content management system that supports MongoDB, allowing you to store Drupal site data in MongoDB instead of the default SQL database.

Laravel MongoDB

An official MongoDB-maintained integration for Laravel, which allows you use MongoDB in a Laravel web application.

Laravel MongoDB documentation

Symfony

A PHP web framework that offers several ways to integrate MongoDB into Symfony, including the following:

Yii 2

A component-based PHP web framework that includes a MongoDB extension.

To use MongoDB for a specific function in your PHP application, use one of the following tools:

Tool
Description
Learn More

LLPhant

A generative AI framework that uses MongoDB as a vector store, letting you build AI-powered applications that use semantic search and vector operations with Voyage AI embeddings.

PHPfastcache

A high-performance backend cache system. Use its MongoDB extension to configure MongoDB as a cache pool for your application.

Enqueue

A messaging solution that can use MongoDB as the message queue broker. This tool provides a standardized interface for programs to create, send, and read messages.

XHGui

A web interface for the XHProf profiler that stores profiling data in MongoDB by default.

XHGui GitHub repository

PHP Cache

A PSR-6 cache implementation that includes a MongoDB adapter.
IMPORTANT: This project is not actively maintained, and the last release was in 2022.

PHP Cache documentation

Flysystem GridFS Adapter

An adapter that allows you to interact with MongoDB GridFS by using Flysystem.

Mongo PHP Adapter

An adapter between applications that rely on the legacy mongo extension and the mongodb extension. Use it only to ease migration from the legacy extension, and use the MongoDB PHP Library directly for new applications.

Mongo PHP Adapter GitHub repository