11.. _php-language-center:
22
3+ .. include:: /includes/unicode-checkmark.rst
4+
35==================
46MongoDB PHP Driver
57==================
@@ -12,33 +14,67 @@ MongoDB PHP Driver
1214 :depth: 1
1315 :class: twocols
1416
15- For the official MongoDB PHP Driver reference, see:
17+ Introduction
18+ ------------
1619
17- - `MongoDB PHP Library Documentation
18- <https://docs.mongodb.com/php-library/ >`_
20+ The currently maintained driver is the `mongodb
21+ <https://pecl.php.net/package/mongodb >`_ extension available from PECL.
1922
20- - `MongoDB PHP Extension Documentation
21- <http://php.net/manual/en/set.mongodb.php>`_
23+ You might consider using the driver with the complimentary `PHP library
24+ <https://github.com/mongodb/mongo-php-library>`_, which implements a more
25+ full-featured API on top of the bare-bones driver.
2226
23- Drivers
24- -------
27+ Further information on this architecture may be found
28+ in the `PHP.net documentation <http://php.net/manual/en/mongodb.overview.php>`_.
29+
30+ - `Tutorials <https://www.php.net/manual/en/mongodb.tutorial.php>`__
31+
32+ - `Driver Architecture and Internals <https://www.php.net/manual/en/mongodb.architecture.php>`__
33+
34+ - `API Reference <https://php.net/manual/en/book.mongodb.php>`_
35+
36+ - `Changelog <https://github.com/mongodb/mongo-php-driver/releases>`__
37+
38+ - `Source Code <https://github.com/mongodb/mongo-php-driver>`__
39+
40+
41+ Installation
42+ ------------
43+
44+ You can install the driver using
45+ `PECL <https://www.php.net/manual/en/mongodb.installation.pecl.php>`_:
46+
47+ .. code-block:: sh
48+
49+ $ pecl install mongodb
50+ $ echo "extension=mongodb.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`
51+
52+ The preferred method of installing the optional but recommended PHP library is with
53+ `Composer <https://getcomposer.org/>`_ by running the following from your project root:
54+
55+ .. code-block:: sh
56+
57+ $ composer require mongodb/mongodb
58+
59+ Additional installation instructions may be found in the
60+ `library documentation <https://docs.mongodb.com/php-library/current/tutorial/install-php-library/>`_.
61+
62+
63+ Connect to MongoDB Atlas
64+ ------------------------
65+
66+ To connect to a `MongoDB Atlas <https://docs.atlas.mongodb.com/>`_ cluster, use the `Atlas connection string <https://docs.atlas.mongodb.com/driver-connection>`__ for your cluster:
67+
68+ .. code-block:: php
69+
70+ <?php
71+
72+ $client = new MongoDB\Client(
73+ 'mongodb+srv://<username>:<password>@<cluster-address>/test?retryWrites=true&w=majority'
74+ );
75+
76+ $db = $client->test;
2577
26- The currently maintained driver is the `mongodb
27- <https://pecl.php.net/package/mongodb>`_ extension available from PECL. This
28- driver can be used stand-alone, although it is very bare-bones. You should
29- consider using the driver with the complimentary `PHP library
30- <https://github.com/mongodb/mongo-php-library>`_, which implements a more
31- full-featured API on top of the bare-bones driver. Further information on this
32- architecture may be found in the `PHP.net documentation
33- <http://php.net/manual/en/mongodb.overview.php>`_.
34-
35- The `mongo <https://pecl.php.net/package/mongo>`_ extension available from PECL
36- is an older, legacy driver for PHP 5.x. The ``mongo`` extension is no longer
37- maintained and new projects are advised to use the ``mongodb`` extension and
38- PHP library. A community-developed `Mongo PHP Adapter
39- <https://github.com/alcaeus/mongo-php-adapter>`_ project implements the legacy
40- ``mongo`` extension's API using the new ``mongodb`` extension and PHP library,
41- which may be useful for those wishing to migrate existing applications.
4278
4379Compatibility
4480-------------
@@ -55,48 +91,16 @@ MongoDB Compatibility
5591Language Compatibility
5692~~~~~~~~~~~~~~~~~~~~~~
5793
58- .. include:: /includes/extracts/php-driver-compatibility-matrix-language.rst
59-
60- .. list-table::
61- :header-rows: 1
62- :stub-columns: 1
63- :class: compatibility-large
64-
65- * - PHP Driver
66- - PHP 5.5
67- - PHP 5.6
68- - PHP 7.0
69- - PHP 7.1
70- - PHP 7.2
71- - PHP 7.3
72-
73- * - mongodb-1.5
74- - |checkmark|
75- - |checkmark|
76- - |checkmark|
77- - |checkmark|
78- - |checkmark|
79- - |checkmark|
80-
81- * - mongodb-1.4
82- - |checkmark|
83- - |checkmark|
84- - |checkmark|
85- - |checkmark|
86- - |checkmark|
87- -
88-
89- * - mongodb-1.3
90- - |checkmark|
91- - |checkmark|
92- - |checkmark|
93- - |checkmark|
94- - |checkmark|
95- -
96-
97- .. include:: /includes/extracts/php-driver-compatibility-full-language.rst
94+ .. include:: /includes/language-compatibility-table-php.rst
95+
96+ How to get help
97+ ---------------
98+
99+ - Join our `Google Group <https://groups.google.com/forum/#!forum/mongodb-user>`__.
100+ - Ask on `Stack Overflow <https://stackoverflow.com/questions/tagged/mongodb+php>`__.
101+ - Visit our `Support Channels <https://docs.mongodb.com/manual/support/>`__.
102+ - See our `JIRA <https://jira.mongodb.org/projects/PHP/summary>`__ to raise issues or request features.
98103
99- .. include:: /includes/unicode-checkmark.rst
100104
101105See Also
102106--------
@@ -109,3 +113,6 @@ See Also
109113 :titlesonly:
110114
111115 /drivers/php-libraries
116+
117+
118+
0 commit comments