Skip to content

Commit 36f9cc7

Browse files
authored
DOCSP-33692: php improvements (#922)
* DOCSP-33692: php improvements * error fixes * test * image width * image width * small fix * vale issues * JS PR fixes 1 * AB tech review comment
1 parent 9284a1f commit 36f9cc7

File tree

3 files changed

+55
-19
lines changed

3 files changed

+55
-19
lines changed

source/figures/PHP_driver_architecture.svg

Lines changed: 1 addition & 0 deletions
Loading

source/php-libraries.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ Standalone Libraries
3737
use this standalone library or use the `Laravel <https://github.com/abellion/xenus-laravel>`__
3838
integration, which adds support for failed jobs, migrations, and events.
3939

40-
4140
Framework Integrations
4241
----------------------
4342

@@ -50,7 +49,7 @@ Framework Integrations
5049

5150
- Laravel
5251

53-
- `Laravel MongoDB <https://github.com/jenssegers/laravel-mongodb>`__ is an
52+
- `Laravel MongoDB <https://github.com/mongodb/laravel-mongodb>`__ is an
5453
Eloquent model and Query builder that supports MongoDB by using the
5554
original Laravel API. This library extends the original Laravel classes
5655
and therefore uses the same methods.
@@ -90,5 +89,4 @@ Tools and Projects
9089
a common way for programs to create, send, and read messages.
9190

9291
- `XHGui <https://github.com/perftools/xhgui>`__ is a web interface for the
93-
XHProf profiler, which stores profiling data in MongoDB.
94-
92+
XHProf profiler, which stores profiling data in MongoDB.

source/php.txt

Lines changed: 52 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
MongoDB PHP Driver
55
==================
66

7-
.. default-domain:: mongodb
8-
97
.. facet::
108
:name: programming_language
119
:values: php
@@ -28,27 +26,29 @@ MongoDB PHP Driver
2826
:depth: 1
2927
:class: twocols
3028

31-
3229
Introduction
3330
------------
3431

3532
Welcome to the documentation site for the official MongoDB PHP driver.
3633
You can add the driver to your application to work with MongoDB in PHP.
3734
The MongoDB PHP Driver consists of the two following components:
3835

39-
- The `extension <https://github.com/mongodb/mongo-php-driver>`_, which
36+
- The `extension <https://github.com/mongodb/mongo-php-driver>`__, which
4037
provides a low-level API and mainly serves to integrate
41-
`libmongoc and libbson <https://www.mongodb.com/docs/drivers/c/>`_ with
38+
:ref:`libmongoc and libbson <c-language-center>` with
4239
PHP.
4340

44-
- The `library <https://www.mongodb.com/docs/php-library/current>`_, which
41+
- The `library <https://www.mongodb.com/docs/php-library/current>`__, which
4542
provides a high-level API for working with MongoDB
4643
databases consistent with other MongoDB language drivers.
4744

4845
While it is possible to use the extension alone, MongoDB recommends
49-
using both the extension and the library together. Download the
50-
components you need or set up a runnable project by following our
51-
tutorials.
46+
using both the extension and the library together. To learn more about
47+
the components of the PHP driver, see the :ref:`Driver Architecture
48+
<php-driver-arch>` section of this page.
49+
50+
Navigate through the following links to learn more about the driver and access
51+
tutorial content on setting up a runnable project:
5252

5353
- `Tutorials <https://www.mongodb.com/docs/php-library/current/tutorial>`__
5454

@@ -72,6 +72,44 @@ tutorials.
7272

7373
- `Extension <https://github.com/mongodb/mongo-php-driver>`__
7474

75+
.. _php-driver-arch:
76+
77+
Driver Architecture
78+
-------------------
79+
80+
This section describes how the components of the PHP driver work together.
81+
These components fit into the following general categories:
82+
83+
- High-Level API, which includes the library and other integrations
84+
- Extension, which includes the extension that integrates the system libraries
85+
- System, which includes the C Driver, BSON library, and encryption library
86+
87+
The following diagram illustrates the architecture of the PHP driver
88+
components:
89+
90+
.. figure:: /figures/PHP_driver_architecture.svg
91+
:alt: PHP driver component architecture
92+
:figwidth: 600px
93+
94+
The PHP library provides an API that is consistent with the other
95+
MongoDB drivers. The library is continually updated to meet cross-driver
96+
specifications. You must add the library as a dependency to access
97+
MongoDB in most PHP applications.
98+
99+
The extension is distributed by using `PECL
100+
<https://www.php.net/manual/en/mongodb.installation.pecl.php>`__, and
101+
connects PHP to the system libraries. The extension's public API
102+
provides the following functionality:
103+
104+
- Connection management
105+
- BSON encoding and decoding
106+
- Object document serialization
107+
- Command execution
108+
- Cursor management
109+
110+
To learn more about the system libraries, see the :ref:`C Driver
111+
<c-language-center>` documentation.
112+
75113
Compatibility
76114
-------------
77115

@@ -80,18 +118,17 @@ following environments:
80118

81119
.. include:: /includes/fact-environments.rst
82120

83-
84121
Installation
85122
------------
86123

87124
First, make sure you have a recent version of PHP installed on your
88125
system. See the
89-
`official PHP manual <https://www.php.net/manual/en/install.php>`_
126+
`official PHP manual <https://www.php.net/manual/en/install.php>`__
90127
for download and installation instructions.
91128

92129
Install the PHP MongoDB Extension before installing the PHP Library for
93130
MongoDB. You can install the extension using
94-
`PECL <https://www.php.net/manual/en/mongodb.installation.pecl.php>`_ on
131+
`PECL <https://www.php.net/manual/en/mongodb.installation.pecl.php>`__ on
95132
the command line:
96133

97134
.. code-block:: sh
@@ -110,7 +147,7 @@ Finally, add the following line to your ``php.ini`` file:
110147
CLI, FPM). Make sure to enable the extension in all SAPIs that you need.
111148

112149
The preferred method of installing the PHP library is with
113-
`Composer <https://getcomposer.org/>`_ by running the following from your project root:
150+
`Composer <https://getcomposer.org/>`__ by running the following from your project root:
114151

115152
.. code-block:: sh
116153

@@ -126,7 +163,7 @@ Composer's autoloader as in the following example:
126163
require_once __DIR__ . '/vendor/autoload.php';
127164

128165
Additional installation instructions may be found in the
129-
`library documentation <https://www.mongodb.com/docs/php-library/current/tutorial/install-php-library/>`_.
166+
`library documentation <https://www.mongodb.com/docs/php-library/current/tutorial/install-php-library/>`__.
130167

131168
.. _connect-atlas-php-driver:
132169

@@ -177,7 +214,7 @@ Compatibility
177214
Due to potential problems representing 64-bit integers on 32-bit platforms,
178215
users are advised to use 64-bit environments. When using a 32-bit platform, be
179216
aware that any 64-bit integer read from the database will be returned as a
180-
`MongoDB\\BSON\\Int64 <https://www.php.net/manual/en/class.mongodb-bson-int64.php>`_
217+
`MongoDB\\BSON\\Int64 <https://www.php.net/manual/en/class.mongodb-bson-int64.php>`__
181218
instance instead of a PHP integer type.
182219

183220
MongoDB Compatibility

0 commit comments

Comments
 (0)