@@ -111,7 +111,7 @@ It helps with establishing a plain TCP/IP connection to Redis
111111and optionally authenticating (AUTH) and selecting the right database (SELECT).
112112
113113``` php
114- $factory->createClient('localhost:6379')->then(
114+ $factory->createClient('redis:// localhost:6379')->then(
115115 function (Client $client) {
116116 // client connected (and authenticated)
117117 },
@@ -121,26 +121,37 @@ $factory->createClient('localhost:6379')->then(
121121);
122122```
123123
124- You can omit the port if you're connecting to the default port 6379:
124+ The ` $redisUri ` can be given in the form ` [redis://][:auth@]host[:port][/db] ` .
125+ You can omit the URI scheme and port if you're connecting to the default port 6379:
125126
126127``` php
128+ // both are equivalent due to defaults being applied
127129$factory->createClient('localhost');
130+ $factory->createClient('redis://localhost:6379');
128131```
129132
130- You can optionally include a password that will be used to authenticate (AUTH command) the client:
133+ Redis supports password-based authentication (` AUTH ` command). Note that Redis'
134+ authentication mechanism does not employ a username, so you can pass the
135+ password "secret" as part of the URI like this:
131136
132137``` php
133- $factory->createClient('auth @localhost');
138+ $factory->createClient('redis://ignored:secret @localhost');
134139```
135140
141+ > Legacy notice: The ` redis:// ` scheme is defined and preferred as of ` v1.2.0 ` .
142+ For BC reasons, the ` Factory ` defaults to the ` tcp:// ` scheme in which case
143+ the authentication details would include the otherwise unused username.
144+ This legacy API will be removed in a future ` v2.0.0 ` version, so it's highly
145+ recommended to upgrade to the above API.
146+
136147You can optionally include a path that will be used to select (SELECT command) the right database:
137148
138149``` php
139- $factory->createClient('localhost/2');
150+ $factory->createClient('redis:// localhost/2');
140151```
141152
142153[ Deprecated] You can omit the complete URI if you want to connect to the default
143- address ` localhost:6379 ` . This legacy API will be removed in a future
154+ address ` redis:// localhost:6379` . This legacy API will be removed in a future
144155` v2.0.0 ` version, so it's highly recommended to upgrade to the above API.
145156
146157``` php
0 commit comments