From fe45823535e2ebf51d404acb4cc9382b60e3807d Mon Sep 17 00:00:00 2001 From: ArrayIterator Date: Sat, 11 Nov 2023 13:30:03 +0700 Subject: [PATCH] update readme --- README.md | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3089c57..596b11b 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Support [PSR-6: Caching Interface](https://www.php-fig.org/psr/psr-6/). ## Requirements - `Php 8.1` or later -- Function `focksopen` enabled & allowed outbond connection to port `53` +- Function `focksopen` enabled & allowed outbound connection to port `53` - Network Connectivity (_Absolutely!_) ## Installing @@ -15,9 +15,42 @@ Support [PSR-6: Caching Interface](https://www.php-fig.org/psr/psr-6/). Currently, in development: ```bash -composer require arrayaccess/dns-client:dev-main +composer require arrayaccess/dns-client ``` +## Usage + +```php +use ArrayAccess\DnsRecord\Cache\Adapter\Psr6CacheAdapter; +use ArrayAccess\DnsRecord\DnsServerStorage;use ArrayAccess\DnsRecord\Resolver; + +$cache = new Psr6CacheAdapter(); +// $cache->setCacheItemPool($cacheProvider); +$dnsServer = DnsServerStorage::createDefault(); +$resolver = new Resolver($dnsServer, $cache); + +/** + * Lookup Single + */ +$useCache = true; // default to true +$timeout = 3.5; // 3.5 seconds +$response = $resolver->lookup('domainname.ext', 'A', 'IN', $timeout, $useCache); + +/** + * Enable Pseudo OPT + */ +$resolver->setDnsSec(true); +$response = $resolver->lookup('domainname.ext', 'A', 'IN'); +$answers = $response->getAnswers(); +$records = $answers->getRecords(); +// Filter "A" Address Only +$arrayA = $records->getFilteredType('A'); + +``` + +> IXFR & AXFR not yet implemented + + ## Note The [RRTypes](src/ResourceRecord/RRTypes) not completed yet,