Skip to content

Commit

Permalink
Simplify usage by supporting new Socket API
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonFrings committed Aug 5, 2021
1 parent d3e55bc commit 09d7814
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ Once [installed](#install), you can use the following code to connect to your
local Redis server and send some requests:

```php
<?php

require __DIR__ . '/vendor/autoload.php';

$factory = new Clue\React\Redis\Factory();

$client = $factory->createLazyClient('localhost');
Expand Down Expand Up @@ -101,7 +105,7 @@ If you need custom DNS, proxy or TLS settings, you can explicitly pass a
custom instance of the [`ConnectorInterface`](https://github.com/reactphp/socket#connectorinterface):

```php
$connector = new React\Socket\Connector(null, array(
$connector = new React\Socket\Connector(array(
'dns' => '127.0.0.1',
'tcp' => array(
'bindto' => '192.168.10.1:0'
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"react/event-loop": "^1.2",
"react/promise": "^2.0 || ^1.1",
"react/promise-timer": "^1.5",
"react/socket": "^1.8"
"react/socket": "^1.9"
},
"require-dev": {
"clue/block-react": "^1.1",
Expand Down
2 changes: 1 addition & 1 deletion src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Factory
public function __construct(LoopInterface $loop = null, ConnectorInterface $connector = null, ProtocolFactory $protocol = null)
{
$this->loop = $loop ?: Loop::get();
$this->connector = $connector ?: new Connector($this->loop);
$this->connector = $connector ?: new Connector(array(), $this->loop);
$this->protocol = $protocol ?: new ProtocolFactory();
}

Expand Down

0 comments on commit 09d7814

Please sign in to comment.