PHPackages                             iamcal/ip-parser - 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. iamcal/ip-parser

ActiveLibrary

iamcal/ip-parser
================

IPv4 &amp; IPv6 parser

v1.0.0(5y ago)17[1 issues](https://github.com/iamcal/php-ip-parser/issues)MITPHPCI failing

Since Apr 21Pushed 5y ago1 watchersCompare

[ Source](https://github.com/iamcal/php-ip-parser)[ Packagist](https://packagist.org/packages/iamcal/ip-parser)[ RSS](/packages/iamcal-ip-parser/feed)WikiDiscussions main Synced 1w ago

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

PHP IPv4 &amp; IPv6 Parser
==========================

[](#php-ipv4--ipv6-parser)

[![Build Status](https://github.com/iamcal/php-ip-parser/actions/workflows/php.yml/badge.svg)](https://github.com/iamcal/php-ip-parser/actions)[![Coverage Status](https://camo.githubusercontent.com/1c4a033a9be12251f6b077147c22a5f64a1f5d6657e795299cbc985a3f2f0c36/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f69616d63616c2f7068702d69702d7061727365722f62616467652e7376673f6272616e63683d6d61696e)](https://coveralls.io/github/iamcal/php-ip-parser?branch=main)[![Latest Stable Version](https://camo.githubusercontent.com/993c477092e00dd24d288037a46557ca2377717a4d80bf0bd49e8575db61aa10/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f69616d63616c2f69702d7061727365722e7376673f7374796c653d666c6174)](https://packagist.org/packages/iamcal/ip-parser)

This simple PHP library is based on [a twitter thread](https://twitter.com/dave_universetf/status/1342685822286360576?s=11)that became [a blog post](https://blog.dave.tf/post/ip-addr-parsing/) about parsing IP addresses.

Usage
-----

[](#usage)

```
$input = "1.2.3.4";

$parser = new iamcal\IPParser();

$out = $parser->parse($input);

```

The single public method, `->parse()`, takes a string and returns an array with two keys:

```
Array
(
    [type] => ipv4
    [canonical] => 1.2.3.4
)

```

The `type` will either be `"ipv4"` or `"ipv6"`, while the `canonical` key will contain a canonicalized version of the IP.

Invalid IPs will throw a catchable exception.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

1853d ago

Major Versions

v0.0.1 → v1.0.02021-04-21

### Community

Maintainers

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

---

Top Contributors

[![iamcal](https://avatars.githubusercontent.com/u/173750?v=4)](https://github.com/iamcal "iamcal (30 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/iamcal-ip-parser/health.svg)

```
[![Health](https://phpackages.com/badges/iamcal-ip-parser/health.svg)](https://phpackages.com/packages/iamcal-ip-parser)
```

PHPackages © 2026

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