@@ -336,9 +336,17 @@ $redis = new Clue\React\Redis\RedisClient('localhost');
336
336
$redis = new Clue\React\Redis\RedisClient('redis://localhost:6379');
337
337
```
338
338
339
- Redis supports password-based authentication (` AUTH ` command). Note that Redis'
340
- authentication mechanism does not employ a username, so you can pass the
341
- password ` h@llo ` URL-encoded (percent-encoded) as part of the URI like this:
339
+ Starting with Redis 6, you can use ACLs and authenticate with both a
340
+ username and a password. Any URI containing user: pass @ will now invoke
341
+ the AUTH <user > <pass > command under the hood. For example:
342
+
343
+ ``` php
344
+ // Authenticate with username and password (Redis 6+ ACL)
345
+ $redis = new Clue\React\Redis\RedisClient('redis://mauricio:mypass@localhost:6379');
346
+ ```
347
+
348
+ If you omit the username (or use an empty userinfo part), the client will fall back
349
+ to the legacy AUTH <pass > behavior:
342
350
343
351
``` php
344
352
// all forms are equivalent
@@ -489,7 +497,15 @@ that eventually *fulfills* with its *results* on success or *rejects* with an
489
497
#### callAsync()
490
498
491
499
The ` callAsync(string $command, string|int|float ...$args): PromiseInterface<mixed> ` method can be used to
492
- invoke a Redis command.
500
+ invoke a Redis command. Note that the ` AUTH ` command now supports ** two** arguments for Redis 6+ ACL mode:
501
+
502
+ ``` php
503
+ // authenticate with username + password (Redis 6+)
504
+ $redis->callAsync('AUTH', 'alice', 'hunter2');
505
+
506
+ // legacy password-only mode
507
+ $redis->callAsync('AUTH', 'hunter2');
508
+ ```
493
509
494
510
For example, the [ ` GET ` command] ( https://redis.io/commands/get ) can be invoked
495
511
like this:
0 commit comments