PHPackages                             synchro/ptrify - 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. synchro/ptrify

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

synchro/ptrify
==============

A utility class for generating DNS PTR records

v1.0.0(2y ago)33MITPHPPHP ^8.1.0

Since Aug 5Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Synchro/Ptrify)[ Packagist](https://packagist.org/packages/synchro/ptrify)[ GitHub Sponsors](https://github.com/synchro)[ Patreon](https://www.patreon.com/marcusbointon)[ RSS](/packages/synchro-ptrify/feed)WikiDiscussions main Synced yesterday

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

 [![Synchro/Ptrify Logo](art/ptrify.jpg)](https://github.com/Synchro/Ptrify)

 [![GitHub Workflow Status (main)](https://github.com/synchro/ptrify/actions/workflows/tests.yml/badge.svg)](https://github.com/synchro/ptrify/actions) [![Total Downloads](https://camo.githubusercontent.com/c9fda83e38a0f5934197ef097590a35eb01ecf1d8bfc0ea4a7cce311cbb608ea/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73796e6368726f2f707472696679)](https://packagist.org/packages/synchro/ptrify) [![Latest Version](https://camo.githubusercontent.com/fc233855ac7e70ca3c74057eca5de76da21a29877d67bdffbb48ee3095d496e1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73796e6368726f2f707472696679)](https://packagist.org/packages/synchro/ptrify) [![License](https://camo.githubusercontent.com/6e92dcbdaefdc8a26a3852cec5c863ce0374d5ba98b5362a2f92e3e112849568/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f73796e6368726f2f707472696679)](https://packagist.org/packages/synchro/ptrify)

---

Ptrify
======

[](#ptrify)

This package provides a simple utility class for converting IP addresses to the format needed for DNS PTR records as defined in [RFC1035](https://www.rfc-editor.org/rfc/rfc1035) and [RFC3596](https://www.rfc-editor.org/rfc/rfc3596#section-2.5). While this can be done manually, it's a slightly tricky process that's easy to get wrong. This package aims to make it easier to generate PTR records for both IPv4 and IPv6 addresses.

This class does not attempt to handle subnets or wildcards, such as those discussed in [RFC 4472](https://www.rfc-editor.org/rfc/rfc4472.html); It is intended for use with single IP addresses only.

> **Requires [PHP 8.1+](https://php.net/releases/)**

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

[](#installation)

Install with [Composer](https://getcomposer.org/):

```
composer require synchro/ptrify
```

Usage
-----

[](#usage)

```
use Synchro\Ptrify\Ptrify;

$ptr = Ptrify::ptrify('192.0.2.151');
//$ptr == '151.2.0.192.in-addr.arpa'

$ptr6 = Ptrify::ptrify('2001:db8:f00::12:34ff:fe56:789a');
//$ptr6 == 'a.9.8.7.6.5.e.f.f.f.4.3.2.1.0.0.0.0.0.0.0.0.f.0.8.b.d.0.1.0.0.2.ip6.arpa'
```

Passing an invalid IP address (either v4 or v6) will throw an `InvalidArgumentException`.

Contributing
------------

[](#contributing)

See [CONTRIBUTING.md](CONTRIBUTING.md) for information, including coding standards and how to run tests.

---

Logo image based on [this image of petrified wood](https://www.flickr.com/photos/petrifiedforestnps/49975052262/) by [Petrifed ForestNPS](https://www.flickr.com/photos/petrifiedforestnps/) under [CC BY 2.0](https://creativecommons.org/licenses/by/2.0/).

Package built from **Skeleton PHP** by **[Nuno Maduro](https://twitter.com/enunomaduro)** under the **[MIT license](https://opensource.org/licenses/MIT)**.

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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

Unknown

Total

1

Last Release

1063d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e7028bcadbec2ee934da04d4d6232600481ac137b30b724ef116dfd55dbe9a9?d=identicon)[Synchro](/maintainers/Synchro)

---

Top Contributors

[![Synchro](https://avatars.githubusercontent.com/u/81561?v=4)](https://github.com/Synchro "Synchro (2 commits)")

---

Tags

phppackagednsnetworkptr

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/synchro-ptrify/health.svg)

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

###  Alternatives

[wujunze/money-wrapper

MoneyPHP Wrapper

103.8k](/packages/wujunze-money-wrapper)

PHPackages © 2026

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