Download the PHP package ljpc/pure-php-doh-client without Composer
On this page you can find all versions of the php package ljpc/pure-php-doh-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ljpc/pure-php-doh-client
More information about ljpc/pure-php-doh-client
Files in ljpc/pure-php-doh-client
Package pure-php-doh-client
Short Description Easily query DNS records via HTTPS
License GPL-3.0-or-later
Informations about the package pure-php-doh-client
Pure PHP DoH Client
This library finally makes it easy to query DNS records in PHP without any third party extensions.
Features
- Automatically query multiple DoH servers (round-robin)
- Prefilled with CloudFlare, Google, Quad9 and AdGuard DoH servers
- Easy to expand servers
- Easy to expand resource records
- No
dig
required, everything is pure PHP - Everything is JSON Serializable
Resource records
The following resource records are available:
- A
- AAAA
- CAA
- CNAME
- DNAME
- DNSKEY
- DS
- KEY
- LOC
- MX
- NS
- NSEC
- PTR
- RRSIG
- SOA
- SPF
- SRV
- TXT
- URI
- TLSA
Installation & loading
LJPc Pure PHP DoH Client is available on Packagist (using semantic versioning), and installation via Composer is the recommended way to install this library.
Just run:
Or add this line to your composer.json
file:
Structure
\LJPc\DoH\DNS::query
always returns a\LJPc\DoH\DNSQueryResult
which contains the following fields:- used server (
->getServer()
) [string] - answers (
->getAnswers()
) [array of \LJPc\DoH\DNSRecord] - authorityRecords (
->getAuthorityRecords()
) [array of \LJPc\DoH\DNSRecord] - additionalRecords (
->getAdditionalRecords()
) [array of \LJPc\DoH\DNSRecord]
- used server (
\LJPc\DoH\DNSRecord
always has the following fields:- domainname [string]
- ttl [int] (according to the queried server)
- type [string] (e.g. A or MX)
- extras [array] (e.g. the priority in an MX record)
- value [string]
Example
Get the A records for cloudflare.com:
Get the PTR for 142.250.185.174:
Get the MX records for gmail.com:
Use a specific DoH server:
License
This software is distributed under the GPL 3.0 license, along with the GPL Cooperation Commitment. Please read LICENSE for information on the software availability and distribution.
Inspiration
This package is inspired by the following packages:
- https://github.com/dcid/doh-php-client
- https://github.com/mikepultz/netdns2
- http://www.purplepixie.org/phpdns/
Custom software
Interested in a library or anything else? Please let us know via www.ljpc.solutions.
Donations
This library took a lot of time. If we helped you or your business, please consider donating. Click here to donate.
All versions of pure-php-doh-client with dependencies
ext-curl Version *