Docs Menu
Docs Home

MongoDB PHP Library

Welcome to the documentation site for the official MongoDB PHP Library.

The PHP library provides a high-level abstraction around the lower-level mongodb extension.

The mongodb extension provides a limited API to connect to a MongoDB database and execute generic commands, queries, and write operations. In contrast, the PHP library provides a full-featured API and models client, database, and collection objects. If you are developing a PHP application with MongoDB, consider using the PHP library instead of the extension alone.

Learn how to install the library and extension, establish a connection to MongoDB, and begin working with data in the Get Started with the PHP Library tutorial.

Learn how to create and configure a connection to a MongoDB deployment in the Connect to MongoDB section.

Learn how to use the PHP library to work with MongoDB databases and collections in the Databases and Collections section.

Learn how to find, update, and delete data in the CRUD Operations section.

Learn how to use the PHP library to perform aggregation operations in the Transform Your Data with Aggregation section.

Learn how to work with specialized data formats and custom types in the Specialized Data Formats section.

Learn how to work with common types of indexes in the Optimize Queries by Using Indexes section.

Learn how to run a database command in the Run a Database Command section.

Learn how to run Atlas Search queries in the Atlas Search section.

Learn how to run Atlas Vector Search queries in the Atlas Vector Search section.

Learn how to monitor changes to your application and write them to logs in the Monitoring and Logging section.

Learn about ways you can authenticate your application and encrypt your data in the Secure Your Data section.

Learn more about PHP library versions, compatibility, and upgrade considerations in the Reference section.

See answers to commonly asked questions about the PHP library in the the Frequently Asked Questions section.

Learn how to report bugs, contribute to the library, and find help in the Issues & Help section.

Next

Get Started

On this page