{"id":13623860,"url":"https://github.com/darsyn/ip","last_synced_at":"2026-01-07T06:38:30.549Z","repository":{"id":36878304,"uuid":"41185287","full_name":"darsyn/ip","owner":"darsyn","description":"Immutable value object for IPv4 and IPv6 addresses, including helper methods and Doctrine support.","archived":false,"fork":false,"pushed_at":"2024-05-10T18:39:48.000Z","size":1315,"stargazers_count":245,"open_issues_count":4,"forks_count":21,"subscribers_count":10,"default_branch":"develop","last_synced_at":"2024-05-17T01:42:26.117Z","etag":null,"topics":["cidr","composer","doctrine","hacktoberfest","immutable","ip","ip-address","ipv4","ipv6","library","packagist","php","rfc","value-object"],"latest_commit_sha":null,"homepage":"http://darsyn.github.io/ip/","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/darsyn.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-08-22T01:46:37.000Z","updated_at":"2024-06-07T10:49:51.474Z","dependencies_parsed_at":"2024-06-07T10:49:45.897Z","dependency_job_id":"c8b4844f-90ce-4f99-9ba6-c266b288ee9b","html_url":"https://github.com/darsyn/ip","commit_stats":{"total_commits":175,"total_committers":8,"mean_commits":21.875,"dds":0.3771428571428571,"last_synced_commit":"8fcfb7907ad3f1ebdfa07a81e186746cb1097c56"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darsyn%2Fip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darsyn%2Fip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darsyn%2Fip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darsyn%2Fip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/darsyn","download_url":"https://codeload.github.com/darsyn/ip/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223684830,"owners_count":17185717,"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":["cidr","composer","doctrine","hacktoberfest","immutable","ip","ip-address","ipv4","ipv6","library","packagist","php","rfc","value-object"],"created_at":"2024-08-01T21:01:36.452Z","updated_at":"2026-01-07T06:38:25.470Z","avatar_url":"https://github.com/darsyn.png","language":"PHP","funding_links":[],"categories":["Table of Contents","目录","PHP"],"sub_categories":["Numbers","数字 Numbers","Globalization"],"readme":"IP is an immutable value object for (both version 4 and 6) IP addresses. Several\nhelper methods are provided for ranges, broadcast and network addresses, subnet\nmasks, whether an IP is a certain type (defined by RFC's), etc.\n\nThis project aims for simplicity of use and any contribution towards that goal -\nwhether a bug report, modifications to the codebase, or an improvement to the\naccuracy or readability of the documentation - are always welcome.\n\n# Documentation\n\nFull documentation is available in the [`docs/`](docs/) folder.\n\n## Compatibility\n\nThis library has extensive test coverage using PHPUnit on PHP versions: `5.6`,\n`7.0`, `7.1`, `7.2`, `7.3`, `7.4`, `8.0`, `8.1`, `8.2`, and `8.3`.\n\nStatic analysis is performed with PHPStan at `max` level on PHP `8.3`, using\ncore, bleeding edge, and deprecation rules.\n\n\u003e The Doctrine features for this library have been split off into their own\n\u003e package, [`darsyn/ip-doctrine`](https://packagist.org/packages/darsyn/ip-doctrine).\n\n## Brief Example\n\n- There are three main classes: [`IPv4`](src/Version/IPv4.php),\n  [`IPv6`](src/Version/IPv6.php), and [`Multi`](src/Version/Multi.php) (for both\n  version 4 and 6 addresses).\n- Objects are created using a static factory method\n  [`IpInterface::factory()`](src/IpInterface.php) instead of the constructor to\n  speed up internal processes.\n- When using `Multi`, the default strategy for representing version 4 addresses\n  internally is [IPv4-mapped](docs/05-strategies.md).\n\n```php\n\u003c?php declare(strict_types=1);\n\nuse Darsyn\\IP\\Exception;\nuse Darsyn\\IP\\Version\\IPv4;\n\ntry {\n    $ip = IPv4::factory('192.168.0.1');\n} catch (Exception\\InvalidIpAddressException $e) {\n    exit('The IP address supplied is invalid!');\n}\n\n$companyNetwork = IPv4::factory('216.58.198.174');\nif (!$ip-\u003einRange($companyNetwork, 25)) {\n    throw new \\Exception('Request not from a known company IP address.');\n}\n\n// Is it coming from the local network?\nif (!$ip-\u003eisPrivateUse()) {\n    record_visit($ip-\u003egetBinary(), $_SERVER['HTTP_USER_AGENT']);\n}\n```\n\n## Code of Conduct\n\nThis project includes and adheres to the [Contributor Covenant as a Code of\nConduct](CODE_OF_CONDUCT.md).\n\n# License\n\nPlease see the [separate license file](LICENSE.md) included in this repository\nfor a full copy of the MIT license, which this project is licensed under.\n\n# Authors\n\n- [Zan Baldwin](https://zanbaldwin.com)\n- [Jaume Casado Ruiz](http://jau.cat)\n- [Pascal Hofmann](http://pascalhofmann.de)\n\nIf you make a contribution (submit a pull request), don't forget to add your\nname here!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarsyn%2Fip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdarsyn%2Fip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarsyn%2Fip/lists"}