Skip to content

Commit

Permalink
Improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
yadaiio committed Feb 13, 2024
1 parent 63fad80 commit ee7f5c0
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,21 @@ as defined in [RFC 6763](https://tools.ietf.org/html/rfc6763).
Once [installed](#install), you can use the following code to look up the address of a local domain name:

```php
$factory = new Factory();
<?php

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

$factory = new Clue\React\Mdns\Factory();
$resolver = $factory->createResolver();

$resolver->lookup('hostname.local')->then(function ($ip) {
echo 'Found: ' . $ip . PHP_EOL;
}, function (Exception $e) {
echo 'Error: ' . $e->getMessage() . PHP_EOL;
});
```

See also the [examples](examples).
See also the [examples](examples/).

## Usage

Expand Down Expand Up @@ -105,9 +111,13 @@ you should look into also using [clue/reactphp-block](https://github.com/clue/re
The resulting blocking code could look something like this:

```php
<?php

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

use Clue\React\Block;

$factory = new Factory();
$factory = new Clue\React\Mdns\Factory();
$resolver = $factory->createResolver();

$promise = $resolver->lookup('me.local');
Expand Down

0 comments on commit ee7f5c0

Please sign in to comment.