@@ -68,6 +68,9 @@ considerations for Windows are discussed in the
68
68
Installing the Library
69
69
----------------------
70
70
71
+ Using Composer
72
+ ~~~~~~~~~~~~~~
73
+
71
74
The preferred method of installing the |php-library| is with
72
75
`Composer <https://getcomposer.org/>`_ by running the following command from
73
76
your project root:
@@ -76,13 +79,6 @@ your project root:
76
79
77
80
composer require mongodb/mongodb
78
81
79
- While not recommended, you may also manually install the library using a source
80
- archive attached to the
81
- `GitHub releases <https://github.com/mongodb/mongo-php-library/releases>`_.
82
-
83
- Configure Autoloading
84
- ~~~~~~~~~~~~~~~~~~~~~
85
-
86
82
Once you have installed the library, ensure that your application includes
87
83
Composer's autoloader as in the following example:
88
84
@@ -96,11 +92,20 @@ Refer to Composer's `autoloading documentation
96
92
<https://getcomposer.org/doc/01-basic-usage.md#autoloading>`_ for more
97
93
information about setting up autoloading.
98
94
99
- If you installed the library manually from a source archive, you will need to
100
- manually configure autoloading:
101
-
102
- #. Map the top-level ``MongoDB\`` namespace to the ``src/`` directory
103
- using your preferred autoloader implementation.
95
+ Manual Installation Without Composer
96
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
104
97
105
- #. Manually require the ``src/functions.php`` file. This is necessary because
106
- PHP does not support autoloading for functions.
98
+ While not recommended, you may also manually install the library using a source
99
+ archive attached to the
100
+ `GitHub releases <https://github.com/mongodb/mongo-php-library/releases>`_. When
101
+ installing the library without Composer, you must ensure that all library
102
+ classes *and* functions are loaded for your application:
103
+
104
+ #. If you are using a `PSR-4 <https://www.php-fig.org/psr/psr-4/>`_ autoloader,
105
+ map the top-level ``MongoDB\`` namespace to the ``src/`` directory. If you
106
+ are not using an autoloader, manually require _all_ class files found
107
+ recursively within the ``src/`` directory.
108
+
109
+ #. Regardless of whether you are using an autoloader, manually require the
110
+ ``src/functions.php`` file. This is necessary because PHP does not support
111
+ autoloading for functions.
0 commit comments