Repository to help getting started with MongoDB PHP driver connecting to MongoDB Atlas.
This Get-Started project uses MongoDB PHP driver version 1.9.1 by default. Although you can change the driver version, the provided code example was only tested against the default version of MongoDB driver. There is no guarantee that the code sample will work for all possible versions of the driver.
Please note that the MongoDB PHP driver consists of two components, the MongoDB extension and library.
Have Docker running on your machine. You can download and install from: https://docs.docker.com/install/
In order to execute the code example, you need to specify MONGODB_URI
environment variable to connect to a MongoDB cluster. If you don't have an existing cluster, you can create one by signing up MongoDB Atlas Free-tier M0.
Execute the helper shell script followed by the MongoDB URI that you would like to connect to.
./get-started.sh "mongodb+srv://usr:[email protected]/dbname?retryWrites=true"
You can invoke a terminal session within the Docker environment using the following command. From the top level directory, execute:
docker run -it -v "$(pwd):/workspace/php" -w /workspace/php ghcr.io/mongodb-developer/get-started-php:0.1 "sh"
This project is part of the MongoDB Get-Started code examples. Please see get-started-readme for more information.
This software is not supported by MongoDB, Inc under any of their commercial support subscriptions or otherwise. Any usage is at your own risk.