@@ -39,20 +39,19 @@ The MongoDB PHP Driver consists of the following components:
3939
4040- `Extension <https://php.net/mongodb>`__:
4141 Provides a low-level API and mainly serves to integrate
42- the `C Driver <https://www.mongodb.com/docs/languages/c/c-driver/current/>`__
43- `libmongoc <https://mongoc.org/libmongoc/current/>`__ and
42+ the `libmongoc <https://mongoc.org/libmongoc/current/>`__ and
4443 `libbson <https://mongoc.org/libbson/current/>`__ libraries with PHP.
4544
4645- `Library <https://www.mongodb.com/docs/php-library/current>`__:
4746 Provides a high-level API for working with MongoDB
4847 databases consistent with other MongoDB language drivers.
4948
50- While it is possible to use the extension alone, MongoDB recommends
51- using both the extension and the library together. To learn more about
49+ While it is possible to use only the extension, we recommend
50+ using the extension and the library together. To learn more about
5251the components of the PHP driver, see the :ref:`php-driver-arch` section
5352of this page.
5453
55- Navigate through the following links to learn more about the driver and access
54+ View the following guides to learn more about the driver and access
5655tutorial content on setting up a runnable project:
5756
5857- `Get Started with the PHP Library <https://www.mongodb.com/docs/php-library/current/get-started/>`__
@@ -102,104 +101,6 @@ provides the following functionality:
102101To learn more about the system libraries, see the `C Driver
103102<https://www.mongodb.com/docs/languages/c/c-driver/current/>`__ documentation.
104103
105- Connect to a Compatible MongoDB Deployment
106- ------------------------------------------
107-
108- You can use the PHP driver to connect to deployments hosted in the
109- following environments:
110-
111- .. include:: /includes/fact-environments.rst
112-
113- Installation
114- ------------
115-
116- First, make sure you have a recent version of PHP installed on your
117- system. See the
118- `official PHP manual <https://www.php.net/manual/en/install.php>`__
119- for download and installation instructions.
120-
121- Install the PHP MongoDB Extension before installing the PHP Library for
122- MongoDB. You can install the extension using
123- `PECL <https://www.php.net/manual/en/mongodb.installation.php>`__ on
124- the command line:
125-
126- .. code-block:: sh
127-
128- $ sudo pecl install mongodb
129-
130- Finally, add the following line to your ``php.ini`` file:
131-
132- .. code-block:: text
133-
134- extension=mongodb.so
135-
136- .. note::
137-
138- On some systems, there may be multiple INI files for individual SAPIs (e.g.
139- CLI, FPM). Make sure to enable the extension in all SAPIs that you need.
140-
141- The preferred method of installing the PHP library is with
142- `Composer <https://getcomposer.org/>`__ by running the following from your project root:
143-
144- .. code-block:: sh
145-
146- $ composer require mongodb/mongodb
147-
148- Once you have installed the library, ensure that your application includes
149- Composer's autoloader as in the following example:
150-
151- .. code-block:: php
152-
153- <?php
154-
155- require_once __DIR__ . '/vendor/autoload.php';
156-
157- Additional installation instructions may be found in the
158- `library documentation <https://www.mongodb.com/docs/php-library/current/tutorial/install-php-library/>`__.
159-
160- .. _connect-atlas-php-driver:
161-
162- Connect to MongoDB Atlas
163- ------------------------
164-
165- You can use the following connection snippet to test your connection to
166- your MongoDB deployment on Atlas:
167-
168- .. literalinclude:: /includes/connection-snippets/scram/php-connection.php
169- :language: php
170-
171- This connection snippet uses the {+stable-api+} feature, which you can
172- enable when using the PHP driver v1.9 and later to connect to MongoDB Server
173- v5.0 and later. When you use this feature, you can update your driver or server without
174- worrying about backward compatibility issues with any commands covered by the
175- {+stable-api+}.
176-
177- To learn more about the {+stable-api+} feature, see
178- :manual:`{+stable-api+} </reference/stable-api/>` in the Server manual.
179-
180- .. include:: /includes/stable-api-notice.rst
181-
182- .. _connect-atlas-no-stable-api-php-driver:
183-
184- Connect to MongoDB Atlas Without the Stable API
185- -----------------------------------------------
186-
187- If you are using a version of MongoDB or the driver that doesn't support the
188- {+stable-api+} feature, you can use the following code snippet to test your connection
189- to your MongoDB deployment on Atlas:
190-
191- .. literalinclude:: /includes/connection-snippets/scram/php-connection-no-stableapi.php
192- :language: php
193-
194- Connect to a MongoDB Server on Your Local Machine
195- -------------------------------------------------
196-
197- .. include:: /includes/localhost-connection.rst
198-
199- To test whether you can connect to your server, replace the connection
200- string in the :ref:`Connect to MongoDB Atlas <connect-atlas-php-driver>` code
201- example and run it.
202-
203104Compatibility
204105-------------
205106
0 commit comments