> For the complete MongoDB documentation index, see www.mongodb.com/docs/llms.txt

# MongoDB\Client Class

## Definition

This class serves as an entry point for the MongoDB PHP Library. It is the preferred class for connecting to a MongoDB server or cluster of servers and acts as a gateway for accessing individual databases and collections. [`MongoDB\Client`](https://www.mongodb.com/docs/php-library/current/reference/class/mongodbclient.md#mongodb-phpclass-phpclass.MongoDB-Client) is analogous to the extension's [MongoDB\Driver\Manager](https://php.net/mongodb-driver-manager) class, which it [composes](https://en.wikipedia.org/wiki/Object_composition).

## Methods

- [`MongoDB\Client::__construct()`](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbclient__construct.md#mongodb-phpmethod-phpmethod.MongoDB-Client--__construct--)

- [`MongoDB\Client::__get()`](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbclient__get.md#mongodb-phpmethod-phpmethod.MongoDB-Client--__get--)

- [`MongoDB\Client::addSubscriber()`](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbclient-addsubscriber.md#mongodb-phpmethod-phpmethod.MongoDB-Client--addSubscriber--)

- [`MongoDB\Client::bulkWrite()`](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbclient-bulkwrite.md#mongodb-phpmethod-phpmethod.MongoDB-Client--bulkWrite--)

- [`MongoDB\Client::createClientEncryption()`](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbclient-createclientencryption.md#mongodb-phpmethod-phpmethod.MongoDB-Client--createClientEncryption--)

- [`MongoDB\Client::dropDatabase()`](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbclient-dropdatabase.md#mongodb-phpmethod-phpmethod.MongoDB-Client--dropDatabase--)

- [`MongoDB\Client::getCollection()`](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbclient-getcollection.md#mongodb-phpmethod-phpmethod.MongoDB-Client--getCollection--)

- [`MongoDB\Client::getDatabase()`](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbclient-getdatabase.md#mongodb-phpmethod-phpmethod.MongoDB-Client--getDatabase--)

- [`MongoDB\Client::getManager()`](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbclient-getmanager.md#mongodb-phpmethod-phpmethod.MongoDB-Client--getManager--)

- [`MongoDB\Client::getReadConcern()`](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbclient-getreadconcern.md#mongodb-phpmethod-phpmethod.MongoDB-Client--getReadConcern--)

- [`MongoDB\Client::getReadPreference()`](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbclient-getreadpreference.md#mongodb-phpmethod-phpmethod.MongoDB-Client--getReadPreference--)

- [`MongoDB\Client::getTypeMap()`](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbclient-gettypemap.md#mongodb-phpmethod-phpmethod.MongoDB-Client--getTypeMap--)

- [`MongoDB\Client::getWriteConcern()`](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbclient-getwriteconcern.md#mongodb-phpmethod-phpmethod.MongoDB-Client--getWriteConcern--)

- [`MongoDB\Client::listDatabaseNames()`](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbclient-listdatabasenames.md#mongodb-phpmethod-phpmethod.MongoDB-Client--listDatabaseNames--)

- [`MongoDB\Client::listDatabases()`](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbclient-listdatabases.md#mongodb-phpmethod-phpmethod.MongoDB-Client--listDatabases--)

- [`MongoDB\Client::removeSubscriber()`](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbclient-removesubscriber.md#mongodb-phpmethod-phpmethod.MongoDB-Client--removeSubscriber--)

- [`MongoDB\Client::selectCollection()`](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbclient-selectcollection.md#mongodb-phpmethod-phpmethod.MongoDB-Client--selectCollection--)

- [`MongoDB\Client::selectDatabase()`](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbclient-selectdatabase.md#mongodb-phpmethod-phpmethod.MongoDB-Client--selectDatabase--)

- [`MongoDB\Client::startSession()`](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbclient-startsession.md#mongodb-phpmethod-phpmethod.MongoDB-Client--startSession--)

- [`MongoDB\Client::watch()`](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbclient-watch.md#mongodb-phpmethod-phpmethod.MongoDB-Client--watch--)
