PHPackages                             littledevnl/iptools - 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. littledevnl/iptools

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

littledevnl/iptools
===================

Small package for handling things with IPs and networks

v1.2(5y ago)16761[1 issues](https://github.com/blackshadev/IPTools/issues)MITPHPPHP &gt;=7.4

Since Jan 18Pushed 5y ago2 watchersCompare

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

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

IPTools
=======

[](#iptools)

[![Latest Version on Packagist](https://camo.githubusercontent.com/00cf7042cefb9d52b5dadd9f3120423bc9c65b31af6e0dc9de27b9f08cfb8dde/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c6974746c656465766e6c2f6970746f6f6c732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/littledevnl/iptools)[![CI](https://camo.githubusercontent.com/331de53771ccc23aa808c73feabf2923ace46d476895135eec1fbd8cce8fdc68/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f626c61636b7368616465762f6970746f6f6c732f43493f6c6162656c3d43492532464344267374796c653d666c61742d737175617265)](https://github.com/blackshadev/iptools/actions?query=workflow%3ACI%2FCD)[![Mutation testing badge](https://camo.githubusercontent.com/ba5eb514b3d40e37984355d50234e6d9369a1440a43239648b505d25c2589d5e/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742675726c3d687474707325334125324625324662616467652d6170692e737472796b65722d6d757461746f722e696f2532466769746875622e636f6d253246626c61636b7368616465762532464950546f6f6c732532466d6173746572)](https://dashboard.stryker-mutator.io/reports/github.com/blackshadev/IPTools/master)

This package is a set of tools for working with IP addresses and networks.

A lot of the internals are inspired by S1lentium/IPTools, but when using that package I noticed I started by wrapping everything I needed in separate classes. Which lead me to create my own package.

The state is pretty alpha at this point but feel free to use it. I do my best to not change the interfaces and facades if possible.

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

[](#installation)

`composer require littledevnl/iptools`

Getting started
---------------

[](#getting-started)

```
use Littledev\IPTools\Address;
use Littledev\IPTools\Network;
use Littledev\IPTools\Iterator\AddressIterator;
use Littledev\IPTools\Family\IPFamily;

$ip = Address::parse($_SERVER['REMOTE_ADDR']);
if ($ip->family() === IPFamily::v6()) {
    echo 'Good for you!';
}

$network6 = Network::parse('2001:db8::/64');
if ($network6->contains($ip)) {
    echo 'You use an IP which is reserved for documentation.';
}

$localNetwork = Network::parse('127.0.0.1/24');
if ($localNetwork->contains($ip)) {
    echo 'No place like localhost.';
}

$iterator = new AddressIterator($localNetwork);
foreach ($iterator as $address) {
    echo 'In local network: ' . $address->address();
}
```

Goals
-----

[](#goals)

- No dependencies.
- A set of tools for parsing and working with IP addresses and networks
- Utility classes should be open for extension through a common parent

Changelog
---------

[](#changelog)

- \[v0.1\] Parsing of IP addresses and networks.
- \[v0.2\] `constains` now accepts networks and addresses. Generalized
- \[v0.3\] Network Iterators
- \[v0.4\] Network lists
- \[v1.0\] Reworked interfaces
- \[v1.1\] Fixed composer PHP requirement, supports PHP7.4 and up
- \[v1.2\] Fix for shorter inAddr inputs

Limitations
-----------

[](#limitations)

Not yet a complete set of tools, it is just the beginning.

Without external dependencies for things like arbitrary precision numbers, it is impossible to do certain things. For instance calculating the number of hosts in a IPV6 network. You can do it yourself with bcmath, see the example below

```
use Littledev\IPTools\Network;
use Littledev\IPTools\Family\IPFamily;

$net = Network::parse('2001:db8::/64');
$numbersOfAddresses =  bcpow('2', (string)(IPFamily::v6()->maxPrefix() - $net->subnet()->prefix()));
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.2% 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 ~14 days

Recently: every ~19 days

Total

7

Last Release

1862d ago

Major Versions

v0.4 → v1.02021-02-06

PHP version history (2 changes)v0.1PHP ^7.4

v1.1PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/113d55d929574a1e524600aa997896c181b5d2fd930bef427d0b3077dad8486a?d=identicon)[littledevnl](/maintainers/littledevnl)

---

Top Contributors

[![blackshadev](https://avatars.githubusercontent.com/u/2979104?v=4)](https://github.com/blackshadev "blackshadev (47 commits)")[![noahlvb](https://avatars.githubusercontent.com/u/6873972?v=4)](https://github.com/noahlvb "noahlvb (4 commits)")

###  Code Quality

TestsPHPUnit

Code StyleECS

### Embed Badge

![Health badge](/badges/littledevnl-iptools/health.svg)

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

###  Alternatives

[tomk79/php-excel2html

Convert Excel(\*.xlsx) to HTML table. with PHPExcel.

1513.7k3](/packages/tomk79-php-excel2html)

PHPackages © 2026

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