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

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

geertw/ip-anonymizer
====================

IPv4 and IPv6 address anonymizer

v1.1.0(8y ago)60238.3k↓17.5%10[1 PRs](https://github.com/geertw/php-ip-anonymizer/pulls)1MITPHP

Since Oct 27Pushed 7y ago3 watchersCompare

[ Source](https://github.com/geertw/php-ip-anonymizer)[ Packagist](https://packagist.org/packages/geertw/ip-anonymizer)[ RSS](/packages/geertw-ip-anonymizer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (1)

[![Latest Stable Version](https://camo.githubusercontent.com/289250d42940ff3f5b94e0ebd4801d263ea5a37d05744b517c92ee071b53157d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6765657274772f69702d616e6f6e796d697a65722e737667)](https://packagist.org/packages/geertw/ip-anonymizer)[![Total Downloads](https://camo.githubusercontent.com/dec7fcff5289498e87a58a19809ddac6f1bb3860e295fc8245759ca94ae98b84/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6765657274772f69702d616e6f6e796d697a65722e737667)](https://packagist.org/packages/geertw/ip-anonymizer)[![License](https://camo.githubusercontent.com/bbeeda373213209874b1d51371760707afc7bf8fd0781a0e4566cc17465074b6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6765657274772f69702d616e6f6e796d697a65722e737667)](https://packagist.org/packages/geertw/ip-anonymizer)

IP address anonymizer for PHP
=============================

[](#ip-address-anonymizer-for-php)

This is a library for PHP to anonymize IP addresses. This makes it easier to respect user privacy, and it makes it more difficult to identify an end user by his IP address. Anonymizing IP addresses can be useful for a lot of cases where the exact IP address is not important or even undesired, for example in a statistical analysis.

This library supports both IPv4 and IPv6 addresses. Addresses are anonymized to their network ID.

The default settings anonymize an IP address to a /24 subnet (IPv4) or a /64 subnet (IPv6), but these can be customized.

For instance, the IPv4 address `192.168.178.123` is anonymized by default to `192.168.178.0`.

The IPv6 address `2a03:2880:2110:df07:face:b00c::1` is anonymized by default to `2a03:2880:2110:df07::`.

Example
-------

[](#example)

```
