=========================================
MongoDB\\Client::createClientEncryption()
=========================================

.. default-domain:: mongodb

.. contents:: On this page
   :local:
   :backlinks: none
   :depth: 1
   :class: singlecol

Definition
----------

.. phpmethod:: MongoDB\Client::createClientEncryption()

   Returns a :php:`MongoDB\Driver\ClientEncryption <class.mongodb-driver-clientencryption>`
   object for manual encryption and decryption of values.

   .. code-block:: php

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

Parameters
----------

``$options`` : array
  An array specifying the desired options. Refer to the
  :php:`MongoDB\Driver\Manager::createClientEncryption() <manual/en/mongodb-driver-manager.createclientencryption.php>`
  extension documentation for a list of supported options.

  If a :phpclass:`MongoDB\Client` is provided for the ``keyVaultClient``
  option, it will be unwrapped into a
  :php:`MongoDB\Driver\Manager <class.mongodb-driver-manager>` for the
  extension.

Return Values
-------------

A :php:`MongoDB\Driver\ClientEncryption <class.mongodb-driver-clientencryption>`
instance which can be used to encrypt and decrypt values.

Errors/Exceptions
-----------------

.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-invalidargumentexception.rst

See Also
--------

- :php:`MongoDB\Driver\Manager::createClientEncryption()
  <manual/en/mongodb-driver-manager.createclientencryption.php>`
