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

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

cooker/ip
=========

1.0(8y ago)015LGPL-3.0PHPPHP &gt;=5.6

Since Aug 8Pushed 8y agoCompare

[ Source](https://github.com/kookeg/IP)[ Packagist](https://packagist.org/packages/cooker/ip)[ RSS](/packages/cooker-ip/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependenciesVersions (2)Used By (0)

Cooker/Tools/IP
===============

[](#cookertoolsip)

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

[](#installation)

With Composer:

```
{
    "require": {
        "cooker/ip": "*"
    }
}
```

Usage
-----

[](#usage)

### IP

[](#ip)

To manipulate an IP address, you can use the `Cooker\Tools\IP` class:

```
$ip = IP::fromStringIP('127.0.0.1');
// IPv6
$ip = IP::fromStringIP('::1');
// In binary format:
$ip = IP::fromBinaryIP("\x7F\x00\x00\x01");

echo $ip->toString(); // 127.0.0.1
echo $ip->toBinary();

// IPv4 & IPv6
if ($ip instanceof IPv4) {}
if ($ip instanceof IPv6) {}

// Hostname reverse lookup
echo $ip->getHostname();

if ($ip->isInRange('192.168.1.1/32')) {}
if ($ip->isInRange('192.168.*.*')) {}

// Anonymize an IP by setting X bytes to null bytes
$ip->anonymize(2);
```

The `Cooker\Tools\IPUtils` class provides utility methods:

```
echo IPUtils::binaryToStringIP("\x7F\x00\x00\x01");
echo IPUtils::stringToBinaryIP('127.0.0.1');

// Sanitization methods
$sanitizedIp = IPUtils::sanitizeIp($_GET['ip']);
$sanitizedIpRange = IPUtils::sanitizeIpRange($_GET['ipRange']);

// IP range
$bounds = IPUtils::getIPRangeBounds('192.168.1.*');
echo $bounds[0]; // 192.168.1.0
echo $bounds[1]; // 192.168.1.255
```

License
-------

[](#license)

The Tools IP is released under the [LGPL v3.0](http://choosealicense.com/licenses/lgpl-3.0/).

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

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

3249d ago

### Community

Maintainers

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

---

Top Contributors

[![kookeg](https://avatars.githubusercontent.com/u/23333629?v=4)](https://github.com/kookeg "kookeg (3 commits)")

### Embed Badge

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

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

###  Alternatives

[stefanbauer/ignition-laracasts-tab

A tab to retrieve laracasts.com answers

5311.5k](/packages/stefanbauer-ignition-laracasts-tab)[tomatophp/filament-seo

Manage and generate SEO tags and integrate your website with Google SEO services

143.4k1](/packages/tomatophp-filament-seo)

PHPackages © 2026

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