PHP - Are there 2 different driver regimens MongoClient and Mongo\Driver\Manager?

I need some guidance about PHP -> MongoDB.

Are there 2 different driver regimens MongoClient and Mongo\Driver\Manager?

Hi @Jack_Woehr,

There are two parts of the stack, the MongoDB PHP Library which provides a high-level abstraction around the lower-level PHP driver which is also known as the mongodb extension.

The lower-level PHP driver (mongodb extension) provides a minimal API for core driver functionality (i.e. commands, queries, writes, connection management, and BSON serialisation). The extension provides MongoDB\Driver\Manager class to manage connections to MongoDB server/clusters.

On the other hand, the MongoDB PHP Library provides a full-featured API and models client, database, and collection objects with their respective helper methods. The library provides MongoDB\Client class to manage connections to MongoDB server/clusters. As the higher level abstraction, MongoDB\Client composes MongoDB\Driver\Manager for users.

For more information see also MongoDB PHP driver: Architecture Overview which shows how all different parts of the MongoDB PHP driver fit together.

Generally if you are developing a PHP application with MongoDB, you should consider using the MongoDB PHP Library instead of the extension alone.

Regards,
Wan

1 Like

Thank you very much @wan for clarifying the layering of the driver architecture.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.