The MongoDB PHP Library is the official high-level library that lets PHP applications interact with MongoDB using a modern, expressive API. It provides object-oriented classes for databases, collections, queries, and operations, so PHP developers can compose CRUD and aggregation pipelines without writing low-level protocol code. Built on top of the underlying MongoDB PHP extension, the library handles serialization, connection pooling, and error handling in a way that feels natural in idiomatic PHP. It supports rich query expressions, bulk writes, change streams, transactions, and GridFS, making it suitable for everything from simple content apps to complex data processing services. The project also includes helpers for working with BSON types such as ObjectId, UTC datetime, and decimals, which helps bridge the gap between native PHP types and MongoDB’s storage model.
Features
- High-level MongoDB API for PHP applications
- Object-oriented database, collection, and query classes
- Supports change streams, transactions, and bulk operations
- Built-in helpers for BSON types like ObjectId and UTC datetime
- GridFS support for large file storage
- Integrates with PHP frameworks and ecosystem tools