PHPackages                             carlosafonso/php-dns-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. carlosafonso/php-dns-client

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

carlosafonso/php-dns-client
===========================

A DNS client written purely in PHP

v0.2.0(6y ago)08MITPHPPHP ~7.2

Since Apr 19Pushed 6y ago1 watchersCompare

[ Source](https://github.com/carlosafonso/php-dns-client)[ Packagist](https://packagist.org/packages/carlosafonso/php-dns-client)[ Docs](https://github.com/carlosafonso/php-dns-client)[ RSS](/packages/carlosafonso-php-dns-client/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (3)Used By (0)

php-dns-client
==============

[](#php-dns-client)

[![Latest Version on Packagist](https://camo.githubusercontent.com/41edc0b70fca6fa40088c109547511beeb9a97add7d7930999ef1bc7d4be73aa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6361726c6f7361666f6e736f2f7068702d646e732d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/carlosafonso/php-dns-client)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/c70eacad1e8616da9d6a0e0ec53c2e8455b79f8552c33e7b5292d7b875dd9f42/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6361726c6f7361666f6e736f2f7068702d646e732d636c69656e742f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/carlosafonso/php-dns-client)[![Coverage Status](https://camo.githubusercontent.com/882781644297a29739e7e945295db4dbf3bea8f6d4bb9e3fb581ddad5676ef9a/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6361726c6f7361666f6e736f2f7068702d646e732d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/carlosafonso/php-dns-client/code-structure)[![Quality Score](https://camo.githubusercontent.com/59197375ca787c61dbbb62e1001778228e0ea71846006cd718e0cfbdf8830cbb/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6361726c6f7361666f6e736f2f7068702d646e732d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/carlosafonso/php-dns-client)

A DNS client library purely implemented in PHP, compatible with PHP 7.2+.

**This is a work in progress.** These are the Resource Record types currently understood by the library:

- A
- AAAA
- CNAME
- NS
- SRV
- MX
- SOA
- PTR

Processing responses with other types of Resource Records currently will result in an exception.

Install
-------

[](#install)

Via Composer:

```
$ composer require carlosafonso/php-dns-client
```

Usage
-----

[](#usage)

The `Client` class it the main entry point to consume the library. `Client` instances allow to send `Request` objects to a name server for resolution using the `query()` method:

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

$client = new Afonso\Dns\Client();

// Let's make an A request for example.com
$request = new Afonso\Dns\Request('google.com', Afonso\Dns\ResourceRecord::TYPE_A);

// Let's send it to name server 8.8.8.8
$response = $client->query($request, '8.8.8.8');

$response->getResourceRecords()[0]; // Instance of AResourceRecord
$response->getResourceRecords()[0]->__toString(); // "216.58.211.238"
```

Security
--------

[](#security)

If you discover any security related issues, please email the author directly instead of using the issue tracker.

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

2265d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/298322ba620ba6518bce36e896723f1f771c4ee6257ab49548c45dcb06e2b9ce?d=identicon)[carlosafonso](/maintainers/carlosafonso)

---

Top Contributors

[![carlosafonso](https://avatars.githubusercontent.com/u/1700229?v=4)](https://github.com/carlosafonso "carlosafonso (29 commits)")

---

Tags

dnscarlosafonso

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/carlosafonso-php-dns-client/health.svg)

```
[![Health](https://phpackages.com/badges/carlosafonso-php-dns-client/health.svg)](https://phpackages.com/packages/carlosafonso-php-dns-client)
```

###  Alternatives

[daverandom/libdns

DNS protocol implementation written in pure PHP

16446.7M15](/packages/daverandom-libdns)[spatie/dns

Retrieve DNS records

6092.7M22](/packages/spatie-dns)[orrison/cumulus

Import DNS records from Laravel Vapor into Cloudflare

3920.3k](/packages/orrison-cumulus)[mesour/dns-checker

DNS checker written in PHP for check and compare real DNS records for domain.

2025.6k](/packages/mesour-dns-checker)[astrotomic/laravel-dns

317.9k](/packages/astrotomic-laravel-dns)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
