uptimeproject / dns
DNS Resolving in PHP
Installs: 4 979
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 3
Forks: 3
Open Issues: 1
Requires
- php: ^7.4|^8.0
- spatie/dns: ^1.4.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16.0
- infection/infection: ^0.21.4
- phpstan/phpstan: ^0.12.25
- phpstan/phpstan-deprecation-rules: ^0.12.5
- phpstan/phpstan-strict-rules: ^0.12.5
- phpunit/phpunit: ^9.0.0
- uptimeproject/php-cs-fixer-config: ^1.1.3
README
This tool is meant as a replacement for dns_get_record
with some extra functionality.
Mainly, it adds the ability to specify a custom nameserver through which to resolve records.
How to use
composer require uptimeproject/dns
$resolver = new \UptimeProject\Dns\DnsResolver; $records = $resolver->resolve('example.com', 'A', 'ns.example.com'); foreach ($records as $record) { echo "The {$record->getType()} record for {$record->getName()} resolves\n"; echo "to {$record->getContent()} with a TTL of {$record->getTTL()} seconds.\n"; }
Specifying the nameserver is optional.
As it is built on top of spatie/dns this tool is inherently built on dig
.
Make sure you have dig installed, otherwise you cannot use this package!
How to contribute
Feel free to create a PR if you have any ideas for improvements. Or create an issue.
- When adding code, make sure to add tests for it (phpunit).
- Make sure the code adheres to our coding standards (use php-cs-fixer to check/fix).
- Also make sure PHPStan does not find any bugs.
vendor/bin/php-cs-fixer fix vendor/bin/phpstan analyze vendor/bin/phpunit --coverage-text phpdbg -qrr vendor/bin/infection
These tools will also run in GitHub actions on PR's and pushes on main.
UptimeProject.io
Check out uptimeproject.io