Skip to content

Commit 396fedc

Browse files
committed
PHPLIB-937: Clarify install steps when not using Composer
1 parent 79b004c commit 396fedc

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

docs/tutorial/install-php-library.txt

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ considerations for Windows are discussed in the
6868
Installing the Library
6969
----------------------
7070

71+
Using Composer
72+
~~~~~~~~~~~~~~
73+
7174
The preferred method of installing the |php-library| is with
7275
`Composer <https://getcomposer.org/>`_ by running the following command from
7376
your project root:
@@ -76,13 +79,6 @@ your project root:
7679

7780
composer require mongodb/mongodb
7881

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-
8682
Once you have installed the library, ensure that your application includes
8783
Composer's autoloader as in the following example:
8884

@@ -96,11 +92,20 @@ Refer to Composer's `autoloading documentation
9692
<https://getcomposer.org/doc/01-basic-usage.md#autoloading>`_ for more
9793
information about setting up autoloading.
9894

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+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10497

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

Comments
 (0)