Returns a MongoDB\Driver\ClientEncryption object for manual encryption and decryption of values.

function createClientEncryption(array $options): MongoDB\Driver\ClientEncryption

This method has the following parameters:

Parameter Type Description
$options array Optional. An array specifying the desired options.

The $options parameter supports all options documented in the extension manual. For the keyVaultClient option, an instance of MongoDB\Client is automatically unwrapped and the MongoDB\Driver\Manager instance is passed to the extension.

Return Values

A MongoDB\Driver\ClientEncryption instance which can be used to encrypt and decrypt values.


MongoDB\Exception\InvalidArgumentException for errors related to the parsing of parameters or options.

MongoDB\Driver\Exception\InvalidArgumentException for errors related to the parsing of parameters or options at the driver level.