PHPackages                             foolz/inet - 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. foolz/inet

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

foolz/inet
==========

A PHP implementation of decimal IPs. Converts IPs from presentation to decimal and viceversa. Very useful to store IPs in database as numbers instead of string, in example in a decimal(39,0) column.

0.6.0(11y ago)82.4k3[1 issues](https://github.com/FoolCode/Inet/issues)1CC-BY-SA-3.0PHPPHP &gt;=5.3.0

Since Sep 15Pushed 11y ago4 watchersCompare

[ Source](https://github.com/FoolCode/Inet)[ Packagist](https://packagist.org/packages/foolz/inet)[ Docs](http://www.foolz.us)[ RSS](/packages/foolz-inet/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (6)Used By (1)

Foolz\\Inet
-----------

[](#foolzinet)

This [Composer](http://getcomposer.org) package provides two functions that allow converting between IP Address and IP Decimal. It works for both IPv4 and IPv6.

Based on the [answer](http://stackoverflow.com/a/1271123/644504) to "[How to convert IPv6 from binary for storage in MySQL?](http://stackoverflow.com/questions/1120371/how-to-convert-ipv6-from-binary-for-storage-in-mysql)" on StackOverflow by [Sander Marechal](http://stackoverflow.com/users/103202/sander-marechal). Content posted on StackOverflow is under the [CC BY-SA 3.0 License](http://creativecommons.org/licenses/by-sa/3.0/).

#### Requirements

[](#requirements)

- [BCMath](http://php.net/manual/en/book.bc.php)
- PHP 5.3+

#### Usage

[](#usage)

```
$decimal_ip = \Foolz\Inet\Inet::ptod($ip);
$ip = \Foolz\Inet\Inet::dtop($decimal_ip);
```

#### Storage on MySQL Databases

[](#storage-on-mysql-databases)

You should use a `DECIMAL(39,0)` column to store the entire IP Decimal.

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community14

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

Every ~232 days

Total

5

Last Release

4103d ago

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/91f963c7229065421bf8896ea56528651997200b496080eccd94ec7e0db5db33?d=identicon)[oohnoitz](/maintainers/oohnoitz)

---

Top Contributors

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

---

Tags

ipv6conversiondecimalIPipv4presentation

### Embed Badge

![Health badge](/badges/foolz-inet/health.svg)

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

###  Alternatives

[zoujingli/ip2region

ip2region v3.0 for PHP - 企业级 IP 地理位置查询库，支持 IPv4 和 IPv6，多种缓存策略，零依赖，开箱即用

1.4k462.5k65](/packages/zoujingli-ip2region)[mlocati/ip-lib

Handle IPv4, IPv6 addresses and ranges

3127.0M58](/packages/mlocati-ip-lib)[s1lentium/iptools

PHP Library for manipulating network addresses (IPv4 and IPv6)

2316.5M27](/packages/s1lentium-iptools)[rlanvin/php-ip

IPv4/IPv6 manipulation library for PHP

179782.2k12](/packages/rlanvin-php-ip)[longman/ip-tools

PHP IP Tools for manipulation with IPv4 and IPv6

147253.5k7](/packages/longman-ip-tools)[markrogoyski/ipv4-subnet-calculator

Network calculator for subnet mask and other classless (CIDR) network information.

175839.3k13](/packages/markrogoyski-ipv4-subnet-calculator)

PHPackages © 2026

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