PHPackages                             manie20/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. manie20/dns

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

manie20/dns
===========

A collection of classes and services to maintain a PHP class representation of a DNS zone file.

v1.0(10y ago)022mitPHPPHP &gt;=5.3.3

Since Jan 29Pushed 10y ago1 watchersCompare

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

READMEChangelogDependencies (1)Versions (6)Used By (0)

DNS Library
===========

[](#dns-library)

This package contains modals and services used for mapping DNS Zone's and DNS records. It is used as a basic for the "manie20/rtr-dns-bundle" which offers the ability to manage Realtime Register DNS zones.

How to use?
-----------

[](#how-to-use)

Let's create a DNS zone by coding objects and output a string which can be used in a DNS zonefile.

```
use Netcode\Dns\Modal\Zone;
use Netcode\Dns\Modal\Domain;
use Netcode\Dns\Modal\Email;
use Netcode\Dns\Modal\Records\SOA;
use Netcode\Dns\Modal\Records\A;
use Netcode\Dns\Modal\Records\CNAME;
use Netcode\Dns\Service\ZoneFileService;
```

To start, let's create a new empty zone.

```
$zone = new Zone();
```

The SOA record is mandatory for a DNS zone and has all the zone file information.

- Name contains the top-level domain for this zone.
- Email address is converted to the zone administrative contact.
- Nameserver is the server address the zone resided in. use 'ns' for the local nameserver.
- SerialNumber is an incremental identifier for when the zone file has changes.

```
$soaRecord = new SOA();
$soaRecord
    ->setName(
        new Domain('netcode.nl')
    )
    ->setEmailAddress(
        new Email('a.krijgsman@netcode.nl')
    )
    ->setNameServer(
        new Domain('ns')
    )
    ->setSerialNumber(
        $soaRecord->getNewSerial()
    );

// Add the SOA Record to the newly created Zone.
$zone->setSoaRecord($soaRecord);
```

Now let's add some DNS records to the zone:

```
$aRecord = new A();
$aRecord->setContent('127.0.0.1');
$zone->addRecord($aRecord);

$aRecord = new A();
$aRecord
   ->setName('www')
   ->setContent('127.0.0.1')
   ->setTTL(300);
$zone->addRecord($aRecord);

$cnameRecord = new CNAME();
$cnameRecord
    ->setName('mail')
    ->setContent('www')
    ->setTTL(7200);
$zone->addRecord($cnameRecord);

// And add the MX record:
$mxRecord = new MX();
$mxRecord
    ->setContent('mail')
    ->setPriority('10')
    ->setTTL(7200);
$zone->addRecord($mxRecord);
```

To test your fully populated zone, you can use the ZoneFileService to output the zone definition. If you feel this needs changes please contact me; I do not actually use it on a running nameserver.

```
$zoneFileService = new ZoneFileService();
$zoneFileService->getZoneText($zone)
```

Resulting in this output:

> netcode.nl. IN SOA ns a.krijgsman.netcode.nl. ( 2016013101 86000 7200 1209600 600 ) IN A 127.0.0.1 www 300 IN A 127.0.0.1 mail 7200 IN CNAME www 7200 IN MX 10 mail

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

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

Total

5

Last Release

3751d ago

Major Versions

v0.3 → v1.02016-01-31

### Community

Maintainers

![](https://www.gravatar.com/avatar/263963ba4abee51dbfc48b723db38ec2f06b2414deba68c001073fa2c1b7b6bb?d=identicon)[netcode](/maintainers/netcode)

---

Top Contributors

[![manie20](https://avatars.githubusercontent.com/u/6900867?v=4)](https://github.com/manie20 "manie20 (28 commits)")

### Embed Badge

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

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

###  Alternatives

[ramsey/devtools

A Composer plugin to aid PHP library and application development.

7134.7k26](/packages/ramsey-devtools)[jimbojsb/workman

PHP process forking &amp; daemonizing library

608.8k](/packages/jimbojsb-workman)

PHPackages © 2026

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