{"id":15674488,"url":"https://github.com/geertw/php-ip-anonymizer","last_synced_at":"2025-08-20T18:32:05.228Z","repository":{"id":60774519,"uuid":"72095748","full_name":"geertw/php-ip-anonymizer","owner":"geertw","description":"IP address anonymizer library for PHP","archived":false,"fork":false,"pushed_at":"2018-09-26T22:17:21.000Z","size":12,"stargazers_count":61,"open_issues_count":1,"forks_count":10,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-12-10T02:20:55.715Z","etag":null,"topics":["gdpr","ip-address","ipv4","ipv6","php","php-library"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/geertw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-27T10:04:03.000Z","updated_at":"2024-07-30T20:27:58.000Z","dependencies_parsed_at":"2022-10-04T15:39:52.133Z","dependency_job_id":null,"html_url":"https://github.com/geertw/php-ip-anonymizer","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geertw%2Fphp-ip-anonymizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geertw%2Fphp-ip-anonymizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geertw%2Fphp-ip-anonymizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geertw%2Fphp-ip-anonymizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geertw","download_url":"https://codeload.github.com/geertw/php-ip-anonymizer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230445926,"owners_count":18227060,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gdpr","ip-address","ipv4","ipv6","php","php-library"],"created_at":"2024-10-03T15:45:36.173Z","updated_at":"2024-12-19T14:06:42.846Z","avatar_url":"https://github.com/geertw.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Latest Stable Version](https://img.shields.io/packagist/v/geertw/ip-anonymizer.svg)](https://packagist.org/packages/geertw/ip-anonymizer)\n[![Total Downloads](https://img.shields.io/packagist/dt/geertw/ip-anonymizer.svg)](https://packagist.org/packages/geertw/ip-anonymizer)\n[![License](https://img.shields.io/packagist/l/geertw/ip-anonymizer.svg)](https://packagist.org/packages/geertw/ip-anonymizer)\n\n# IP address anonymizer for PHP\n\nThis is a library for PHP to anonymize IP addresses. This makes it easier to respect user privacy, and it makes it more\ndifficult to identify an end user by his IP address. Anonymizing IP addresses can be useful for a lot of cases where the\nexact IP address is not important or even undesired, for example in a statistical analysis.\n\nThis library supports both IPv4 and IPv6 addresses. Addresses are anonymized to their network ID.\n\nThe default settings anonymize an IP address to a /24 subnet (IPv4) or a /64 subnet (IPv6), but these can be customized.\n\nFor instance, the IPv4 address `192.168.178.123` is anonymized by default to `192.168.178.0`.\n\nThe IPv6 address `2a03:2880:2110:df07:face:b00c::1` is anonymized by default to `2a03:2880:2110:df07::`.\n\n## Example\n\n```php\n\u003c?php\nuse geertw\\IpAnonymizer\\IpAnonymizer;\nrequire 'vendor/autoload.php';\n\n$ipAnonymizer = new IpAnonymizer();\n\nvar_dump($ipAnonymizer-\u003eanonymize('127.0.0.1'));\n// returns 127.0.0.0\n\nvar_dump($ipAnonymizer-\u003eanonymize('192.168.178.123'));\n// returns 192.168.178.0\n\nvar_dump($ipAnonymizer-\u003eanonymize('8.8.8.8'));\n// returns 8.8.8.0\n\nvar_dump($ipAnonymizer-\u003eanonymize('::1'));\n// returns ::\n\nvar_dump($ipAnonymizer-\u003eanonymize('::127.0.0.1'));\n// returns ::\n\nvar_dump($ipAnonymizer-\u003eanonymize('2a03:2880:2110:df07:face:b00c::1'));\n// returns 2a03:2880:2110:df07::\n\nvar_dump($ipAnonymizer-\u003eanonymize('2610:28:3090:3001:dead:beef:cafe:fed3'));\n// returns 2610:28:3090:3001::\n\n// Use a custom mask:\n$ipAnonymizer-\u003eipv4NetMask = \"255.255.0.0\";\nvar_dump($ipAnonymizer-\u003eanonymize('192.168.178.123'));\n// returns 192.168.0.0\n\n// You can use this class also in a static way:\nvar_dump(IpAnonymizer::anonymizeIp('192.168.178.123'));\n// returns 192.168.178.0\n\nvar_dump(IpAnonymizer::anonymizeIp('2610:28:3090:3001:dead:beef:cafe:fed3'));\n// returns 2610:28:3090:3001::\n```\n\n## License\n\nThis library is licensed under the MIT License. See the [LICENSE](LICENSE) file for the full license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeertw%2Fphp-ip-anonymizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeertw%2Fphp-ip-anonymizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeertw%2Fphp-ip-anonymizer/lists"}