PHPackages                             fhferreira/php-dig - 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. fhferreira/php-dig

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

fhferreira/php-dig
==================

Use servers CLI command dig over php internal dns\_get\_record() function - just a fork of hostinger/php-dig

1.2(1y ago)035.0k↓39.5%MITPHPPHP &gt;=5.6

Since Feb 22Pushed 1y agoCompare

[ Source](https://github.com/fhferreira/php-dig)[ Packagist](https://packagist.org/packages/fhferreira/php-dig)[ RSS](/packages/fhferreira-php-dig/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (72)Used By (0)

php-dig
=======

[](#php-dig)

Introduction
------------

[](#introduction)

[PHP DNS functions](http://php.net/manual/en/ref.network.php) don't have a timeout while the default timeout for dig is 5 seconds (with several (3) tries)

It should drastically decrease time to get dns records, and lower failure errors like `dns_get_record(): A temporary server error occurred.`

Installation
------------

[](#installation)

Install the latest version with

```
$ composer require fhferreira/php-dig
```

Usage
-----

[](#usage)

```
$client = new Hostinger\DigClient();
$result = $client->getRecord('hostinger.com', DNS_MX);
```

This is equal to

```
dns_get_record('hostinger.com', DNS_MX);
```

Package checks if it can run `exec` in server environment, otherwise it will fallback to dns\_get\_record().

### DigClient implements LoggerAwareInterface

[](#digclient-implements-loggerawareinterface)

You can set [logger](https://github.com/Seldaek/monolog/) to debug / log package activity

```
$client = new Hostinger\DigClient();
$logger = new \Monolog\Logger\Logger('App');
$logger->pushHandler(new StreamHandler('path/to/your.log'));
$client->setLogger($logger);
```

About
-----

[](#about)

### Requirements

[](#requirements)

- php-dig client works with PHP 5.6 or above.

### Submitting bugs and feature requests

[](#submitting-bugs-and-feature-requests)

Bugs and feature request are tracked on [GitHub](https://github.com/hostinger/php-dig/issues)

Sources
-------

[](#sources)

- [Stack overflow question What would cause checkdnsrr() or dns\_get\_record() to take too long?](http://stackoverflow.com/questions/14065946/what-would-cause-checkdnsrr-or-dns-get-record-to-take-too-long)
- [Reddit thread: dns\_get\_record suddenly running very slowly](https://www.reddit.com/r/PHP/comments/2k3ns7/dns_get_record_suddenly_running_very_slowly/)

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance44

Moderate activity, may be stable

Popularity27

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 64.7% 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 ~595 days

Total

3

Last Release

445d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6737936990660260df87570e586c254abe975be9f0a7f3964abf38ed5012b4b7?d=identicon)[fhferreira](/maintainers/fhferreira)

---

Top Contributors

[![vaidas-lungis](https://avatars.githubusercontent.com/u/5111555?v=4)](https://github.com/vaidas-lungis "vaidas-lungis (11 commits)")[![fhferreira](https://avatars.githubusercontent.com/u/140686?v=4)](https://github.com/fhferreira "fhferreira (5 commits)")[![fordnox](https://avatars.githubusercontent.com/u/398619?v=4)](https://github.com/fordnox "fordnox (1 commits)")

---

Tags

dnsdigdns\_get\_record

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fhferreira-php-dig/health.svg)

```
[![Health](https://phpackages.com/badges/fhferreira-php-dig/health.svg)](https://phpackages.com/packages/fhferreira-php-dig)
```

###  Alternatives

[daverandom/libdns

DNS protocol implementation written in pure PHP

16339.1M9](/packages/daverandom-libdns)[spatie/dns

Retrieve DNS records

6082.3M17](/packages/spatie-dns)[orrison/cumulus

Import DNS records from Laravel Vapor into Cloudflare

3817.1k](/packages/orrison-cumulus)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[mesour/dns-checker

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

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

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

PHPackages © 2026

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