PHPackages                             givi/ipman - 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. givi/ipman

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

givi/ipman
==========

IP library with useful functions

41PHP

Since May 11Pushed 6y ago1 watchersCompare

[ Source](https://github.com/givipapava/php-ipman)[ Packagist](https://packagist.org/packages/givi/ipman)[ RSS](/packages/givi-ipman/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

php-ipman
=========

[](#php-ipman)

Useful IP tools for php

Instalation
===========

[](#instalation)

```
 composer require givi/ipman
```

Permissions
===========

[](#permissions)

Created By: Givi Papava
Version: 1.0
Language: PHP

### Change Log

[](#change-log)

NameVersionDescriptionDatePHP ip tools1.0.0In Production03-14-2020Usage
-----

[](#usage)

### IP

[](#ip)

```
$loader =  require __DIR__.'/vendor/autoload.php';
use GiviPapava\IPMan\IPMan;

$ipMan = new IPMan();
// Check if ip is valid
echo  $ipMan->isValidIp('162.168.1.321'); // true, false

// parse, combined parseLong,parseBin and parseHex
echo $ipMan->parse('2130706433','long'); //  127.0.0.1

echo $ipMan->parse('11000100101010000100000100100001','bin'); // 196.168.65.33

echo $ipMan->parse('0b002001','hex'); // 10.0.32.1

// checks if IP is valid IPv4.
echo $ipMan->isV4('182.168.1.1'); //true

// checks if IP is valid IPv6.
echo $ipMan->isV6('2001:db8:0:1:1:1:1:1'); //true

// parselong
echo $ipMan->parseLong('2130706433'); //  127.0.0.1

// parseBin
 echo $ipMan->parseBin('11000100101010000100000100100001'); // 196.168.65.33

// parseHex
echo $ipMan->parseHex('0a002001'); // 10.0.32.1

// Get ip version
echo $ipMan->getIpVersion('182.168.1.1'); // ipv4
echo $ipMan->getIpVersion('2001:db8:0:1:1:1:1:1'); //  ipv6

// ReversePointer

echo $ipMan->getReversePointer('182.0.2.5'); // 5.2.0.182.in-addr.arpa

echo $ipMan->getReversePointer('162.128.1.1'); // 1.1.128.162.in-addr.arpa

// MaxLengthPrefix

echo $ipMan->getMaxPrefixLength('2001:db8:0:1:1:1:1:1'); // 128

 //  octetsCount
echo $ipMan->getOctetsCount('2001:db8:0:1:1:1:1:1'); // 16

// Match

echo  $ipMan->match('162.128.1.1', '162.128.1.*'); // true
echo  $ipMan->match('162.128.1.1', '162.128.0.*');  // false

 // Ip in Randge
 echo $ipMan->ipInRange('127.0.0.1','127.0.0.0/24'); // true
```

Location
--------

[](#location)

```
 // Get generic location based on ip
echo $ipMan->getIpLocation('182.0.2.5');

    {
       "ip": "182.0.2.5",
       "iso_code": "ID",
       "country": "Indonesia",
       "city": "Bali",
       "sub_division":"Sumatra",
       "latitude": "-6.175",
       "longitude":106.8286,
       "network ":"182.0.0.0\/17"
    }

// Get generic latitue,longitute based on ip
echo $ipMan->getIPLatitureAndLongitute('182.0.2.5');
 {
    "latitude":-6.175,
    "longitude":106.8286
 }
```

### Network

[](#network)

```
echo $ipMan->cidrToMask('182.0.2.5'); // "255.255.252.0"

echo $ipMan->countSetbits($number) // int(22)

echo  $ipMan->validNetMask('255.255.252.0'); // true

echo $ipMan->validNetMask('127.0.0.1'); // false

echo $ipMan->maskToCidr('255.255.252.0'); // int(22)

echo $ipMan->alignedCIDR('127.0.0.1','255.255.252.0'); //string(12) "127.0.0.0/22"
```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1331564?v=4)[Givi](/maintainers/Givi)[@givi](https://github.com/givi)

---

Top Contributors

[![givipapava](https://avatars.githubusercontent.com/u/22425154?v=4)](https://github.com/givipapava "givipapava (1 commits)")

### Embed Badge

![Health badge](/badges/givi-ipman/health.svg)

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

###  Alternatives

[pharaonic/php-dot-array

Access array data quickly/easily using dot-notation and asterisk.

1011.6k3](/packages/pharaonic-php-dot-array)

PHPackages © 2026

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