Skip to content

Commit 29fa6a9

Browse files
authored
DOCSP-39181: drupal integration page (#1002)
* DOCSP-39181: drupal integration page * wip: * MW PR fixes 1 * wip * remove unused files * vale fix
1 parent c8ab94e commit 29fa6a9

6 files changed

Lines changed: 161 additions & 145 deletions

File tree

source/includes/connection-snippets/scram/php-connection-no-stableapi.php

Lines changed: 0 additions & 18 deletions
This file was deleted.

source/includes/connection-snippets/scram/php-connection.php

Lines changed: 0 additions & 22 deletions
This file was deleted.

source/php-drivers.txt

Lines changed: 42 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ MongoDB PHP Driver
2020
:titlesonly:
2121

2222
Laravel MongoDB <https://www.mongodb.com/docs/drivers/php/laravel-mongodb/current>
23-
/php-frameworks/symfony
24-
/php-libraries
23+
Symfony Integration </php-frameworks/symfony>
24+
Drupal Integration </php-frameworks/drupal>
25+
Libraries, Frameworks, & Tools </php-libraries>
2526

2627
.. contents:: On this page
2728
:local:
@@ -36,44 +37,31 @@ Welcome to the documentation site for the official MongoDB PHP driver.
3637
You can add the driver to your application to work with MongoDB in PHP.
3738
The MongoDB PHP Driver consists of the following components:
3839

39-
- The `extension <https://github.com/mongodb/mongo-php-driver>`__, which
40-
provides a low-level API and mainly serves to integrate
41-
`libmongoc and libbson <https://www.mongodb.com/docs/languages/c/c-driver/current/>`__ with
42-
PHP.
40+
- `Extension <https://php.net/mongodb>`__:
41+
Provides a low-level API and mainly serves to integrate
42+
the `libmongoc <https://mongoc.org/libmongoc/current/>`__ and
43+
`libbson <https://mongoc.org/libbson/current/>`__ libraries with PHP.
4344

44-
- The `library <https://www.mongodb.com/docs/php-library/current>`__, which
45-
provides a high-level API for working with MongoDB
45+
- `Library <https://www.mongodb.com/docs/php-library/current>`__:
46+
Provides a high-level API for working with MongoDB
4647
databases consistent with other MongoDB language drivers.
4748

48-
While it is possible to use the extension alone, MongoDB recommends
49-
using both the extension and the library together. To learn more about
50-
the components of the PHP driver, see the :ref:`Driver Architecture
51-
<php-driver-arch>` section of this page.
49+
While it is possible to use only the extension, we recommend
50+
using the extension and the library together. To learn more about
51+
the components of the PHP driver, see the :ref:`php-driver-arch` section
52+
of this page.
5253

53-
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
5455
tutorial content on setting up a runnable project:
5556

56-
- `Tutorials <https://www.mongodb.com/docs/php-library/current/tutorial>`__
57+
- `Get Started with the PHP Library <https://www.mongodb.com/docs/php-library/current/get-started/>`__
58+
- `Connect to MongoDB <https://www.mongodb.com/docs/php-library/current/connect/>`__
5759

58-
- `Extension Architecture and Internals <https://www.php.net/manual/en/mongodb.architecture.php>`__
60+
Reference
61+
~~~~~~~~~
5962

60-
- Documentation
61-
62-
- `Library <https://www.mongodb.com/docs/php-library/current>`__
63-
64-
- `Extension <https://php.net/mongodb>`__
65-
66-
- Changelog
67-
68-
- `Library <https://github.com/mongodb/mongo-php-library/releases>`__
69-
70-
- `Extension <https://github.com/mongodb/mongo-php-driver/releases>`__
71-
72-
- Source Code
73-
74-
- `Library <https://github.com/mongodb/mongo-php-library>`__
75-
76-
- `Extension <https://github.com/mongodb/mongo-php-driver>`__
63+
- :github:`Release Notes <mongodb/mongo-php-driver/releases>`
64+
- :github:`Driver Source Code <mongodb/mongo-php-driver>`
7765

7866
.. _php-driver-arch:
7967

@@ -124,92 +112,53 @@ following environments:
124112
Installation
125113
------------
126114

127-
First, make sure you have a recent version of PHP installed on your
128-
system. See the
129-
`official PHP manual <https://www.php.net/manual/en/install.php>`__
115+
Make sure you have a recent version of PHP installed on your
116+
system. See the `PHP manual <https://www.php.net/manual/en/install.php>`__
130117
for download and installation instructions.
131118

132-
Install the PHP MongoDB Extension before installing the PHP Library for
133-
MongoDB. You can install the extension using
134-
`PECL <https://www.php.net/manual/en/mongodb.installation.php>`__ on
135-
the command line:
119+
Install the PHP MongoDB Extension before you install the MongoDB PHP
120+
Library. You can install the extension by using `PECL
121+
<https://www.php.net/manual/en/mongodb.installation.php>`__ on the
122+
command line:
136123

137124
.. code-block:: sh
138125

139-
$ sudo pecl install mongodb
126+
sudo pecl install mongodb
140127

141-
Finally, add the following line to your ``php.ini`` file:
128+
After installation completes, add the following line to your ``php.ini``
129+
file:
142130

143131
.. code-block:: text
144132

145133
extension=mongodb.so
146134

147135
.. note::
148136

149-
On some systems, there may be multiple INI files for individual SAPIs (e.g.
150-
CLI, FPM). Make sure to enable the extension in all SAPIs that you need.
137+
On some systems, there might be multiple ``.ini`` files for
138+
individual SAPIs, such as CLI, FPM. Make sure to enable the extension
139+
in all SAPIs that you use.
151140

152-
The preferred method of installing the PHP library is with
153-
`Composer <https://getcomposer.org/>`__ by running the following from your project root:
141+
Then, install the PHP library by using `Composer
142+
<https://getcomposer.org/>`__. Run the following command from your
143+
project directory:
154144

155145
.. code-block:: sh
156146

157-
$ composer require mongodb/mongodb
147+
composer require mongodb/mongodb
158148

159-
Once you have installed the library, ensure that your application includes
160-
Composer's autoloader as in the following example:
149+
After installation completes, ensure that your application includes
150+
Composer's autoloader as shown in the following example:
161151

162152
.. code-block:: php
163153

164154
<?php
165155

166156
require_once __DIR__ . '/vendor/autoload.php';
167157

168-
Additional installation instructions may be found in the
169-
`library documentation <https://www.mongodb.com/docs/php-library/current/tutorial/install-php-library/>`__.
170-
171-
.. _connect-atlas-php-driver:
172-
173-
Connect to MongoDB Atlas
174-
------------------------
175-
176-
You can use the following connection snippet to test your connection to
177-
your MongoDB deployment on Atlas:
178-
179-
.. literalinclude:: /includes/connection-snippets/scram/php-connection.php
180-
:language: php
181-
182-
This connection snippet uses the {+stable-api+} feature, which you can
183-
enable when using the PHP driver v1.9 and later to connect to MongoDB Server
184-
v5.0 and later. When you use this feature, you can update your driver or server without
185-
worrying about backward compatibility issues with any commands covered by the
186-
{+stable-api+}.
187-
188-
To learn more about the {+stable-api+} feature, see
189-
:manual:`{+stable-api+} </reference/stable-api/>` in the Server manual.
190-
191-
.. include:: /includes/stable-api-notice.rst
192-
193-
.. _connect-atlas-no-stable-api-php-driver:
194-
195-
Connect to MongoDB Atlas Without the Stable API
196-
-----------------------------------------------
197-
198-
If you are using a version of MongoDB or the driver that doesn't support the
199-
{+stable-api+} feature, you can use the following code snippet to test your connection
200-
to your MongoDB deployment on Atlas:
201-
202-
.. literalinclude:: /includes/connection-snippets/scram/php-connection-no-stableapi.php
203-
:language: php
204-
205-
Connect to a MongoDB Server on Your Local Machine
206-
-------------------------------------------------
207-
208-
.. include:: /includes/localhost-connection.rst
209-
210-
To test whether you can connect to your server, replace the connection
211-
string in the :ref:`Connect to MongoDB Atlas <connect-atlas-php-driver>` code
212-
example and run it.
158+
The `PHP Library documentation
159+
<https://www.mongodb.com/docs/php-library/current>`__ contains reference
160+
materials and tutorials that demonstrate how to interact with your
161+
MongoDB data.
213162

214163
Compatibility
215164
-------------
@@ -245,9 +194,3 @@ The first column lists the driver versions.
245194
.. include:: /includes/about-driver-compatibility.rst
246195

247196
.. include:: /includes/help-links-php.rst
248-
249-
See Also
250-
--------
251-
252-
- :ref:`php-libraries-frameworks-and-tools`
253-

source/php-frameworks/drupal.txt

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
.. _php-drupal-integration:
2+
3+
==========================
4+
Drupal MongoDB Integration
5+
==========================
6+
7+
.. facet::
8+
:name: genre
9+
:values: tutorial
10+
11+
.. meta::
12+
:keywords: php framework, CMS, web app, authentication, Atlas
13+
14+
.. contents:: On this page
15+
:local:
16+
:backlinks: none
17+
:depth: 2
18+
:class: singlecol
19+
20+
Overview
21+
--------
22+
23+
In this guide, you can learn about the benefits of using MongoDB Atlas
24+
as the database for Drupal sites.
25+
26+
`Drupal <https://www.drupal.org/about>`__ is an open-source web content
27+
management system (CMS) written in PHP. Drupal provides simple content
28+
authoring, composability, and robust authentication features.
29+
30+
The :ref:`php-drupal-tutorial` section of this guide links to a tutorial
31+
that you can follow to set up a Drupal site that connects to MongoDB Atlas.
32+
33+
The :ref:`php-drupal-resources` section contains links to resources and
34+
documentation for further learning.
35+
36+
Why Use MongoDB as the Database for Drupal Sites?
37+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
38+
39+
Websites that seek to provide personalized user experiences must contain
40+
robust capabilities for user authentication. Sites that have many
41+
authenticated users might face performance impacts due to the complexity
42+
of retrieving entity data from multiple tables in a relational database.
43+
MongoDB eliminates the need for complicated table joins and
44+
thus increases data retrieval speed, enhancing user experience of
45+
components such as personalized dashboards and dynamic content feeds.
46+
47+
When you use MongoDB Atlas as your site's database, Drupal stores entity
48+
instances as JSON objects that contain all revisions, translations, and
49+
field data. This flexible data structure decreases latency and allows
50+
Drupal to support personalized, user-focused experiences.
51+
52+
MongoDB offers the following features that improve your Drupal sites:
53+
54+
- Horizontal scaling: Distribute loads across multiple
55+
servers, making your database scalable for large user bases.
56+
57+
- Integrated file storage: Store user files directly in the
58+
database instead of on the web server, simplifying hosting.
59+
60+
- Full-text search: Avoid implementing separate search
61+
solutions by leveraging the :atlas:`Atlas Search
62+
</atlas-search/atlas-search-overview/>` feature.
63+
64+
- AI capabilities: Perform vector searches and integrate AI services by
65+
using the :atlas:`Atlas Vector Search
66+
</atlas-vector-search/vector-search-overview/>` feature.
67+
68+
.. _php-drupal-tutorial:
69+
70+
Tutorial
71+
--------
72+
73+
To learn how to install the MongoDB driver for Drupal and set up a site
74+
that uses MongoDB Atlas as its database, see the
75+
`How to Run Drupal on MongoDB <https://dev.to/mongodb/how-to-install-drupal-on-mongodb-atlas-2dg3>`__
76+
tutorial on the DEV Community website.
77+
78+
This tutorial demonstrates how to perform the following steps:
79+
80+
1. Setting up a MongoDB Atlas account and deployment.
81+
82+
#. Setting up an AWS EC2 medium instance.
83+
84+
#. Connecting the EC2 instance to Atlas.
85+
86+
#. Installing the following components:
87+
88+
- Apache web server
89+
- `MongoDB PHP extension <https://php.net/mongodb>`__
90+
- Drupal web server
91+
- Drupal core patch
92+
93+
#. Connecting your Drupal site to Atlas.
94+
95+
#. Adding content to Drupal and viewing how it is stored in Atlas.
96+
97+
#. Safely shutting down your web server.
98+
99+
.. _php-drupal-resources:
100+
101+
Resources
102+
---------
103+
104+
Learn more about Drupal and MongoDB by viewing the following resources:
105+
106+
- `MongoDB module suite for Drupal <https://www.drupal.org/project/mongodb>`__
107+
- `Drupal CMS User Guide <https://new.drupal.org/docs/drupal-cms>`__
108+
- :website:`Podcast: PHP, Drupal and MongoDB with David Bekker
109+
</developer/podcasts/ep-185-php-drupal-and-mongodb-with-david-bekker/>`

source/php-frameworks/symfony.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ read about the benefits of using Symfony to build
2626
web applications with MongoDB as your database and practice using libraries
2727
that simplify querying MongoDB.
2828

29-
Symfony is a flexible and highly configurable framework for building PHP
30-
applications. You can use this framework to create reusable components
31-
to streamline your web app.
29+
`Symfony <https://symfony.com/>`__ is a flexible and highly configurable
30+
framework for building PHP applications. You can use this framework to
31+
create reusable components to streamline your web app.
3232

3333
The :ref:`php-symfony-qs` section of this guide contains a tutorial
3434
which you can follow to build a single page app that accesses data from
@@ -124,9 +124,9 @@ Atlas documentation.
124124
Install MongoDB Extension
125125
~~~~~~~~~~~~~~~~~~~~~~~~~
126126

127-
To learn more about installing the MongoDB extension, see `Installing the Extension
128-
<https://www.mongodb.com/docs/php-library/current/tutorial/install-php-library/#installing-the-extension>`__
129-
in the PHP Library Manual.
127+
To learn more about installing the MongoDB extension, see the `Get
128+
Started with the PHP Library
129+
<https://www.mongodb.com/docs/php-library/current/get-started/#download-and-install>`__ tutorial.
130130

131131
Initialize a Symfony Project
132132
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

source/php-libraries.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ Framework Integrations
5858
types of Drupal data in MongoDB. The ``mongodb`` extension supports
5959
Drupal 8 and later.
6060

61+
- :ref:`php-drupal-integration` describes the benefits of using MongoDB
62+
as a data store in a Drupal site and provides useful links to learn
63+
about using this integration.
64+
6165
- Laravel
6266

6367
- `Laravel MongoDB <https://www.mongodb.com/docs/drivers/php/laravel-mongodb/current/>`__

0 commit comments

Comments
 (0)