===================
MongoDB PHP Library
===================

.. default-domain:: mongodb

The |php-library| provides a high-level abstraction around the lower-level
`PHP driver <https://php.net/mongodb>`_, also known as the ``mongodb``
extension.

The ``mongodb`` extension provides a limited API to connect to the database and
execute generic commands, queries, and write operations. In contrast, the
|php-library| provides a full-featured API and models client, database, and
collection objects. Each of those classes provide various helper methods for
performing operations in context. For example, :phpclass:`MongoDB\\Collection`
implements methods for executing CRUD operations and managing indexes on the
collection, among other things.

If you are developing a PHP application with MongoDB, you should consider using
the |php-library| instead of the extension alone.

New to the PHP Library?
-----------------------

If you have some experience with MongoDB but are new to the PHP library, the
following pages should help you get started:

- :doc:`/tutorial/install-php-library`

- :doc:`/tutorial/connecting`

- :doc:`/tutorial/crud`

- :doc:`/tutorial/commands`

- :doc:`/tutorial/gridfs`

- :doc:`/tutorial/modeling-bson-data`

- :doc:`/reference/bson`

Code examples can be found in the ``examples`` directory in the source code.

If you have previously worked with the legacy ``mongo`` extension, it will be
helpful to review the :doc:`/upgrade` for a summary of API changes between the
old driver and this library.

New to MongoDB?
---------------

If you are a new MongoDB user, the following links should help you become more
familiar with MongoDB and introduce some of the concepts and terms you will
encounter in the library documentation:

- :manual:`Introduction to MongoDB </introduction>`

- :manual:`Databases and Collections </core/databases-and-collections>`

- :manual:`Documents </core/document>` and
  :manual:`BSON Types </reference/bson-types>`

- :manual:`MongoDB CRUD Operations </crud>`

.. class:: hidden

   .. toctree::
      :titlesonly:

      Installation </tutorial/install-php-library>
      /tutorial
      /upgrade
      /reference
      FAQ </faq>
