@@ -15,15 +15,15 @@ factory. All you need to give it is a nameserver, then you can start resolving
1515names, baby!
1616
1717``` php
18- $loop = React\EventLoop\Factory::create();
19- $factory = new React\Dns\Resolver\Factory();
20- $dns = $factory->create('8.8.8.8', $loop);
21-
22- $dns->resolve('igor.io')->then(function ($ip) {
23- echo "Host: $ip\n";
24- });
25-
26- $loop->run();
18+ $loop = React\EventLoop\Factory::create();
19+ $factory = new React\Dns\Resolver\Factory();
20+ $dns = $factory->create('8.8.8.8', $loop);
21+
22+ $dns->resolve('igor.io')->then(function ($ip) {
23+ echo "Host: $ip\n";
24+ });
25+
26+ $loop->run();
2727```
2828
2929But there's more.
@@ -33,33 +33,50 @@ But there's more.
3333You can cache results by configuring the resolver to use a ` CachedExecutor ` :
3434
3535``` php
36- $loop = React\EventLoop\Factory::create();
37- $factory = new React\Dns\Resolver\Factory();
38- $dns = $factory->createCached('8.8.8.8', $loop);
36+ $loop = React\EventLoop\Factory::create();
37+ $factory = new React\Dns\Resolver\Factory();
38+ $dns = $factory->createCached('8.8.8.8', $loop);
39+
40+ $dns->resolve('igor.io')->then(function ($ip) {
41+ echo "Host: $ip\n";
42+ });
3943
40- $dns->resolve('igor.io')->then(function ($ip) {
41- echo "Host: $ip\n";
42- });
44+ ...
4345
44- ...
46+ $dns->resolve('igor.io')->then(function ($ip) {
47+ echo "Host: $ip\n";
48+ });
4549
46- $dns->resolve('igor.io')->then(function ($ip) {
47- echo "Host: $ip\n";
48- });
49-
50- $loop->run();
50+ $loop->run();
5151```
5252
5353If the first call returns before the second, only one query will be executed.
5454The second result will be served from cache.
5555
56- ## Todo
56+ ## Install
57+
58+ The recommended way to install this library is [ through Composer] ( http://getcomposer.org ) .
59+ [ New to Composer?] ( http://getcomposer.org/doc/00-intro.md )
60+
61+ This will install the latest supported version:
62+
63+ ``` bash
64+ $ composer require react/dns:~ 0.4.0
65+ ```
66+
67+ If you care a lot about BC, you may also want to look into supporting legacy versions:
68+
69+ ``` bash
70+ $ composer require " react/dns:~0.4.0|~0.3.0"
71+ ```
72+
73+ More details and upgrade guides can be found in the [ CHANGELOG] ( CHANGELOG.md ) .
74+
75+ ## License
5776
58- * Implement message body parsing for types other than A and CNAME: NS, SOA, PTR, MX, TXT, AAAA
59- * Implement ` authority ` and ` additional ` message parts
60- * Respect /etc/hosts
77+ MIT, see [ LICENSE file] ( LICENSE ) .
6178
62- # References
79+ ## References
6380
64- * [ RFC1034 ] ( http://tools.ietf.org/html/rfc1034 ) Domain Names - Concepts and Facilities
65- * [ RFC1035 ] ( http://tools.ietf.org/html/rfc1035 ) Domain Names - Implementation and Specification
81+ * [ RFC 1034 ] ( http://tools.ietf.org/html/rfc1034 ) Domain Names - Concepts and Facilities
82+ * [ RFC 1035 ] ( http://tools.ietf.org/html/rfc1035 ) Domain Names - Implementation and Specification
0 commit comments