PHPackages                             redbox/dns - 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. [Database &amp; ORM](/categories/database)
4. /
5. redbox/dns

ActiveLibrary[Database &amp; ORM](/categories/database)

redbox/dns
==========

Quickly retrieve any type of DNS record you wish using PHP

v1.1(9y ago)81.4k4MITPHPPHP &gt;=5.4.0CI failing

Since Apr 12Pushed 8y ago2 watchersCompare

[ Source](https://github.com/johnnymast/redbox-dns)[ Packagist](https://packagist.org/packages/redbox/dns)[ Docs](https://github.com/johnnymast/redbox-dns)[ RSS](/packages/redbox-dns/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (2)Dependencies (1)Versions (6)Used By (0)

[![Build Status](https://camo.githubusercontent.com/a3264a602902239dfaf7166f23eb682c00936772ca0b7dd7220f1118ea762f01/68747470733a2f2f7472617669732d63692e6f72672f6a6f686e6e796d6173742f726564626f782d646e732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/johnnymast/redbox-dns)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/f8dfaec876237284328d67086720afc417172727a1d7ee73f0e69ac3b736e8d8/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a6f686e6e796d6173742f726564626f782d646e732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/johnnymast/redbox-dns/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/7dd3e9ae3c560248b2caed6926af5ee68a5036bf83ae80ee710678853d5517d7/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6a6f686e6e796d6173742f726564626f782d646e732f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/johnnymast/redbox-dns/?branch=master)[![Twitter URL](https://camo.githubusercontent.com/bd57172cd5d35575e65898eaf1abad4b23224163dd93edc5e9e00e3609dc1929/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f75726c2f687474702f736869656c64732e696f2e7376673f7374796c653d736f6369616c266c6162656c3d436f6e74616374253230617574686f72)](https://twitter.com/intent/tweet?text=@mastjohnny)

Redbox-dns
==========

[](#redbox-dns)

Redbox-dns can be used to quickly query dns records a given domain. The API it self is extremely easy to use but you can always check out the [examples](https://github.com/johnnymast/redbox-dns/tree/master/examples) directory for some examples.

Examples
========

[](#examples)

In the examples directory you find usecases on how you can this class. Below you find an extremely easy way of receiving the mx records for Google.com and print them out. You can find this example once again in the examples directory.

```
$resolver = new \Redbox\DNS\Resolver();
$resolver->resolve('google.com', DNS_MX);

foreach($resolver as $record) {
    if ($record['type'] == 'MX')
        echo $record['type'] . ' ' . $record['pri'] . ' '. $record['target']."\n";
};
```

***ouput***

```
$ php ./mxrecords.php
MX 30 alt2.aspmx.l.google.com
MX 20 alt1.aspmx.l.google.com
MX 40 alt3.aspmx.l.google.com
MX 50 alt4.aspmx.l.google.com
MX 10 aspmx.l.google.com
```

Resolve Options
===============

[](#resolve-options)

The second parameter to the resolve method can be used to define the desired record type to return. Below is a list of the available record types.

TypeRecord TypeDescriptionDNS\_ALLALLIteratively query the name server for each available record typeDNS\_AAIPv4 Address ResourceDNS\_CNAMECNAMEAlias (Canonical Name) ResourceDNS\_HINFOHINFOHost Info ResourceDNS\_MXMXMail Exchanger ResourceDNS\_NSNSAuthoritative Name Server ResourceDNS\_PTRPTRPointer Resource (Reverse DNS)DNS\_SOASOAStart of Authority ResourceDNS\_TXTTXTText ResourceDNS\_AAAAAAAAPv6 Address ResourceDNS\_SRVSRVService record (SRV record)DNS\_NAPTRNAPTRName Authority Pointer***Example: Retrieve all CNAME records***

```
/* retreive all CNAME records */
$resolver->resolve('google.com', DNS_CNAME);
```

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

[](#installation)

Using [composer](https://getcomposer.org/):

```
$ composer require redbox/dns
```

Installation trough archive download
------------------------------------

[](#installation-trough-archive-download)

If you download the package from a website (for example [github.io](https://github.com/johnnymast/redbox-dns/) or [phpclasses.org](http://www.phpclasses.org/package/9719-PHP-Quickly-retrieve-any-type-of-DNS-record-you-wish.html) or any other) you will need composer installed on your machine. The reason for this is that Redbox-dns comes without the require vendor directory which is required to run the package.

First of all if you don't have composer installed you can find it [here](https://getcomposer.org/) follow the instructions and don't get intimidated in fact its really really easy to install.

In the this sample i will assume you have composer installed (on any machine). Go to the package root (where composer.json is located) and execute the following command.

```
$ composer install  --no-dev
```

Unit Testing
------------

[](#unit-testing)

Redbox-dns comes with a suite of tests that you can run. The tests will be automaticaly run on [trevis-ci.com](https://travis-ci.org/johnnymast/redbox-dns) and inspected on [scrutinizer-ci.com](https://scrutinizer-ci.com/g/johnnymast/redbox-dns/?branch=master).

Requirements
------------

[](#requirements)

The following versions of PHP are supported by this version.

- PHP 5.4
- PHP 5.5
- PHP 5.6
- PHP 7.0
- PHP 7.1
- HHVM

License
-------

[](#license)

Redbox-dns is released under the MIT public license.

[LICENSE](https://github.com/johnnymast/redbox-dns/blob/master/LICENSE.md)

Author
------

[](#author)

This package is created and maintained by [Johnny Mast](https://github.com/johnnymast). If you have any questions feel free to contact me on twitter by using [@mastjohnny](https://twitter.com/intent/tweet?text=@mastjohnny) in your tweet.

Enjoy
-----

[](#enjoy)

Oh and if you've come down this far, you might as well [follow me](https://twitter.com/mastjohnny) on twitter.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity62

Established project with proven stability

 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 ~118 days

Total

5

Last Release

3259d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d5a228d3118e6b9e3c3c189ea1c8d3a13ed4c9ac312b9217654c81f6d4214cc8?d=identicon)[johnnymast](/maintainers/johnnymast)

---

Top Contributors

[![johnnymast](https://avatars.githubusercontent.com/u/121194?v=4)](https://github.com/johnnymast "johnnymast (46 commits)")

---

Tags

composerdns-recorddns-resolverphpservicemigrationunixserverdnstoolswindowsutilitiesnetworkingit

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/redbox-dns/health.svg)

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

###  Alternatives

[rector/rector

Instant Upgrade and Automated Refactoring of any PHP code

10.4k139.2M8.9k](/packages/rector-rector)[kitloong/laravel-migrations-generator

Generates Laravel Migrations from an existing database

2.9k8.2M33](/packages/kitloong-laravel-migrations-generator)[directorytree/ldaprecord

A fully-featured LDAP ORM.

5793.4M17](/packages/directorytree-ldaprecord)[ssch/typo3-rector

Instant fixes for your TYPO3 PHP code by using Rector.

2603.2M418](/packages/ssch-typo3-rector)[cybercog/laravel-clickhouse

ClickHouse migrations for Laravel

166251.3k1](/packages/cybercog-laravel-clickhouse)[a9f/typo3-fractor

TYPO3 extension for the File Read-Analyse-Change Tool. Allows modifying XML files

19338.4k51](/packages/a9f-typo3-fractor)

PHPackages © 2026

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