Permalink
Fetching contributors…
Cannot retrieve contributors at this time
175 lines (129 sloc) 3.68 KB
.. _php-language-center:
==================
PHP MongoDB Driver
==================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: twocols
For the official MongoDB PHP reference, see:
- `MongoDB PHP Documentation
<http://mongodb.github.io/mongo-php-library/?jmp=docs>`_
- `MongoDB PHP API Reference <http://mongodb.github.io/mongo-php-library/api/>`_
Access MongoDB from PHP
-----------------------
To access MongoDB from PHP you need:
- The MongoDB server running. The server is the ":program:`mongod`" file,
not the ":program:`mongo`" client (note the "d" at the end).
- The MongoDB PHP driver installed.
Drivers
-------
The currently maintained driver is the **mongodb** extension available from
PECL. This driver can be used stand-alone, although it is very bare-bones. You
should consider using the driver with the complimentary *PHP library*, which
implements a more full-featured API on top of the bare-bones driver.
For further information on the architecture, please refer to this
`blog post <https://www.mongodb.com/blog/post/call-feedback-new-php-and-hhvm-drivers>`_.
There is also an older legacy driver called **mongo**. New projects should
use the **mongodb** extension with the *PHP library*. The
links below point to the documentation for the new **mongodb** extension.
Compatibility
-------------
MongoDB Compatibility
~~~~~~~~~~~~~~~~~~~~~
.. include:: /includes/extracts/php-driver-compatibility-matrix-mongodb.rst
.. list-table::
:header-rows: 1
:stub-columns: 1
:widths: 20 20 20 20 20
:class: compatibility
* - PHP Driver
- MongoDB 2.4
- MongoDB 2.6
- MongoDB 3.0
- MongoDB 3.2
* - PHPLIB 1.0 + mongodb-1.1
- |checkmark|
- |checkmark|
- |checkmark|
- |checkmark|
* - mongodb-1.1
- |checkmark|
- |checkmark|
- |checkmark|
- |checkmark|
* - mongodb-1.0
- |checkmark|
- |checkmark|
- |checkmark|
-
* - mongo-1.6
- |checkmark|
- |checkmark|
- |checkmark|
-
* - mongo-1.5
- |checkmark|
- |checkmark|
-
-
.. include:: /includes/extracts/php-driver-compatibility-full-mongodb.rst
.. include:: /includes/older-server-versions-unsupported.rst
Language Compatibility
~~~~~~~~~~~~~~~~~~~~~~
.. include:: /includes/extracts/php-driver-compatibility-matrix-language.rst
.. list-table::
:header-rows: 1
:stub-columns: 1
:class: compatibility-large
* - PHP Driver
- PHP 5.3
- PHP 5.4
- PHP 5.5
- PHP 5.6
- PHP 7.0
- HHVM 3.9
* - mongodb-1.1
-
- |checkmark|
- |checkmark|
- |checkmark|
- |checkmark|
- |checkmark|
* - mongodb-1.0
-
- |checkmark|
- |checkmark|
- |checkmark|
-
- |checkmark|
* - mongo-1.6
- |checkmark|
- |checkmark|
- |checkmark|
- |checkmark|
-
-
* - mongo-1.5
- |checkmark|
- |checkmark|
- |checkmark|
- |checkmark|
-
-
.. include:: /includes/extracts/php-driver-compatibility-full-language.rst
.. include:: /includes/unicode-checkmark.rst
See Also
--------
- :ref:`php-libraries-frameworks-and-tools` for working with Drupal,
Cake, Symfony, and more from MongoDB
- :ref:`admin-uis`
- MongoDB for the PHP Mind Blog Series:
- `Part 1: Getting Started <http://blog.mongodb.org/post/24960636131/mongodb-for-the-php-mind-part-1>`_
- `Part 2: Queries and Indexes <http://blog.mongodb.org/post/26903435041/mongodb-for-the-php-mind-part-2>`_
- `Part 3: Data Modeling <http://blog.mongodb.org/post/35133050249/mongodb-for-the-php-mind-part-3>`_
.. toctree::
:titlesonly:
/drivers/php-libraries