-
Notifications
You must be signed in to change notification settings - Fork 34
DOCSP-43204: Connection landing page #147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
norareidy
merged 12 commits into
mongodb:php-standardization
from
norareidy:DOCSP-43204-connection-landing
Sep 26, 2024
Merged
Changes from 2 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
945bfac
DOCSP-43204: Connection landing page
norareidy fd44093
toc edit
norareidy e74febe
edits
norareidy 74813fd
remove compression
norareidy 70f6162
fix
norareidy 0bedb02
sample app
norareidy 67a3b4f
snooty
norareidy 54aa80a
JM feedback
norareidy 5f06c44
replica set
norareidy 17ca258
JM feedback 2
norareidy 264dee1
Merge remote-tracking branch 'upstream/php-standardization' into DOCS…
norareidy 4c38673
JM last feedback
norareidy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -2,30 +2,36 @@ | |||
|
||||
require 'vendor/autoload.php'; | ||||
|
||||
use MongoDB\Client; | ||||
|
||||
// Connects to a local MongoDB deployment | ||||
// start-local | ||||
$uri = 'mongodb://localhost:27017/'; | ||||
jmikola marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
$client = new Client($uri); | ||||
$client = new MongoDB\Client($uri); | ||||
// end-local | ||||
|
||||
// Connects to a MongoDB Atlas deployment | ||||
// start-atlas | ||||
$uri = '<Atlas connection string>'; | ||||
$client = new Client($uri); | ||||
$client = new MongoDB\Client($uri); | ||||
// end-atlas | ||||
|
||||
// Connects to a replica set | ||||
// start-replica-set | ||||
// Connects to a replica set using client options | ||||
// start-replica-set-client | ||||
$client = new MongoDB\Client( | ||||
'mongodb://<replica set member>:<port>/', | ||||
['replicaSet' => '<replica set name>'], | ||||
); | ||||
// end-replica-set-client | ||||
|
||||
// Connects to a replica set using a connection URI parameter | ||||
// start-replica-set-uri | ||||
$uri = 'mongodb://<replica set member>:<port>/?replicaSet=<replica set name>'; | ||||
jmikola marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
$client = new Client($uri); | ||||
// end-replica-set | ||||
$client = new MongoDB\Client($uri); | ||||
// end-replica-set-uri | ||||
|
||||
// Connects to a MongoDB deployment and enables TLS using client | ||||
// options | ||||
// start-enable-tls-client | ||||
jmikola marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
$client = new Client( | ||||
$client = new MongoDB\Client( | ||||
'mongodb://<hostname>:<port>/', | ||||
['tls' => true], | ||||
); | ||||
|
@@ -35,13 +41,13 @@ | |||
// parameters | ||||
// start-enable-tls-uri | ||||
$uri = 'mongodb://<hostname>:<port>/?tls=true'; | ||||
$client = new Client($uri); | ||||
$client = new MongoDB\Client($uri); | ||||
// end-enable-tls-uri | ||||
|
||||
// Connects to a MongoDB deployment, enables TLS, and specifies the path to | ||||
// a CA file using client options | ||||
// start-ca-file-client | ||||
$client = new Client( | ||||
$client = new MongoDB\Client( | ||||
'mongodb://<hostname>:<port>/', | ||||
['tls' => true, 'tlsCAFile' => '/path/to/ca.pem'], | ||||
); | ||||
|
@@ -51,13 +57,13 @@ | |||
// a CA file using connection URI parameters | ||||
// start-ca-file-uri | ||||
$uri = 'mongodb://<hostname>:<port>/?tls=true&tlsCAFile=/path/to/ca.pem'; | ||||
$client = new Client($uri); | ||||
$client = new MongoDB\Client($uri); | ||||
// end-ca-file-uri | ||||
|
||||
// Connects to a MongoDB deployment, enables TLS, and prevents OCSP endpoint checks | ||||
norareidy marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
// using client options | ||||
// start-disable-ocsp-client | ||||
$client = new Client( | ||||
$client = new MongoDB\Client( | ||||
'mongodb://<hostname>:<port>/', | ||||
['tls' => true, 'tlsDisableOCSPEndpointCheck' => true], | ||||
); | ||||
|
@@ -67,13 +73,13 @@ | |||
// using connection URI parameters | ||||
// start-disable-ocsp-uri | ||||
$uri = 'mongodb://<hostname>:<port>/?tls=true&tlsDisableOCSPEndpointCheck=true'; | ||||
$client = new Client($uri); | ||||
$client = new MongoDB\Client($uri); | ||||
// end-disable-ocsp-uri | ||||
|
||||
// Connects to a TLS-enabled deployment and instructs the driver to check the | ||||
// server certificate against a CRL | ||||
jmikola marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
// start-crl | ||||
$client = new Client( | ||||
$client = new MongoDB\Client( | ||||
'mongodb://<hostname>:<port>/', | ||||
['tls' => true], | ||||
['crl_file' => '/path/to/file.pem'], | ||||
|
@@ -83,7 +89,7 @@ | |||
// Presents a client certificate to prove identity | ||||
// using client options | ||||
// start-client-cert-client | ||||
$client = new Client( | ||||
$client = new MongoDB\Client( | ||||
'mongodb://<hostname>:<port>/', | ||||
['tls' => true, 'tlsCertificateKeyFile' => '/path/to/client.pem'], | ||||
); | ||||
|
@@ -93,12 +99,12 @@ | |||
// using connection URI parameters | ||||
// start-client-cert-uri | ||||
$uri = 'mongodb://<hostname>:<port>/?tls=true&tlsCertificateKeyFile=/path/to/client.pem'; | ||||
$client = new Client($uri); | ||||
$client = new MongoDB\Client($uri); | ||||
// end-client-cert-uri | ||||
|
||||
// Specifies the password for a client certificate using client options | ||||
// start-key-file-client | ||||
$client = new Client( | ||||
$client = new MongoDB\Client( | ||||
'mongodb://<hostname>:<port>/', | ||||
[ | ||||
'tls' => true, | ||||
|
@@ -111,13 +117,13 @@ | |||
// Specifies the password for a client certificate using connection URI parameters | ||||
// start-key-file-uri | ||||
$uri = 'mongodb://<hostname>:<port>/?tls=true&tlsCertificateKeyFile=/path/to/client.pem&tlsCertificateKeyFilePassword=<password>'; | ||||
jmikola marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
$client = new Client($uri); | ||||
$client = new MongoDB\Client($uri); | ||||
// end-key-file-uri | ||||
|
||||
// Connects to a TLS-enabled deployment and disables server certificate verification | ||||
// using client options | ||||
// start-insecure-tls-client | ||||
$client = new Client( | ||||
$client = new MongoDB\Client( | ||||
'mongodb://<hostname>:<port>/', | ||||
['tls' => true, 'tlsInsecure' => true], | ||||
); | ||||
|
@@ -127,12 +133,12 @@ | |||
// using connection URI parameters | ||||
// start-insecure-tls-uri | ||||
$uri = 'mongodb://<hostname>:<port>/?tls=true&tlsInsecure=true'; | ||||
$client = new Client($uri); | ||||
$client = new MongoDB\Client($uri); | ||||
// end-insecure-tls-uri | ||||
|
||||
// Disables certificate validation using client options | ||||
// start-disable-cert-client | ||||
$client = new Client( | ||||
$client = new MongoDB\Client( | ||||
'mongodb://<hostname>:<port>/', | ||||
['tls' => true, 'tlsAllowInvalidCertificates' => true], | ||||
); | ||||
|
@@ -141,13 +147,13 @@ | |||
// Disables certificate validation using connection URI parameters | ||||
// start-disable-cert-uri | ||||
$uri = 'mongodb://<hostname>:<port>/?tls=true&tlsAllowInvalidCertificates=true'; | ||||
$client = new Client($uri); | ||||
$client = new MongoDB\Client($uri); | ||||
// end-disable-cert-uri | ||||
|
||||
// Connects to a TLS-enabled deployment and disables hostname verification | ||||
// using client options | ||||
// start-disable-hostname-client | ||||
$client = new Client( | ||||
$client = new MongoDB\Client( | ||||
'mongodb://<hostname>:<port>/', | ||||
['tls' => true, 'tlsAllowInvalidHostnames' => true], | ||||
); | ||||
|
@@ -157,18 +163,17 @@ | |||
// using connection URI parameters | ||||
// start-disable-hostname-uri | ||||
$uri = 'mongodb://<hostname>:<port>/?tls=true&tlsAllowInvalidHostnames=true'; | ||||
$client = new Client($uri); | ||||
$client = new MongoDB\Client($uri); | ||||
// end-disable-hostname-uri | ||||
|
||||
// Connects to a MongoDB deployment and enables the stable API | ||||
// start-stable-api | ||||
$uri = '<connection string>'; | ||||
$clientOptions = [ | ||||
'serverApi' => [ | ||||
'version' => '1', | ||||
], | ||||
]; | ||||
$client = new Client($uri, $clientOptions); | ||||
$driverOptions = ['serverApi' => new MongoDB\Driver\ServerApi(ServerApi::V1)]; | ||||
jmikola marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
$client = new MongoDB\Client( | ||||
'mongodb://<hostname>:<port>/', | ||||
[], | ||||
$driverOptions, | ||||
); | ||||
// end-stable-api | ||||
|
||||
?> | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
No need for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll add removing those to the cleanup tasks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.