{"id":21372991,"url":"https://github.com/hiqdev/php-ip-tools","last_synced_at":"2025-07-13T07:32:33.333Z","repository":{"id":43007642,"uuid":"408072160","full_name":"hiqdev/php-ip-tools","owner":"hiqdev","description":"A library for IP addresses calculations","archived":false,"fork":false,"pushed_at":"2022-06-03T16:53:34.000Z","size":66,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-12T19:47:10.154Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hiqdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-19T08:26:19.000Z","updated_at":"2024-01-30T16:42:10.000Z","dependencies_parsed_at":"2022-08-21T11:50:58.244Z","dependency_job_id":null,"html_url":"https://github.com/hiqdev/php-ip-tools","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/hiqdev%2Fphp-ip-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiqdev%2Fphp-ip-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiqdev%2Fphp-ip-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiqdev%2Fphp-ip-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hiqdev","download_url":"https://codeload.github.com/hiqdev/php-ip-tools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225865488,"owners_count":17536462,"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":[],"created_at":"2024-11-22T08:24:27.988Z","updated_at":"2024-11-22T08:24:28.591Z","avatar_url":"https://github.com/hiqdev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP IP tools\n\n[![GitHub Actions](https://github.com/hiqdev/php-ip-tools/workflows/Tests/badge.svg)](https://github.com/hiqdev/php-ip-tools/actions)\n[![Infection MSI](https://badge.stryker-mutator.io/github.com/hiqdev/php-ip-tools/master)](https://infection.github.io)\n\nThis library provides tooling for IP address calculations based on [rlanvin/php-ip](https://github.com/rlanvin/php-ip)\n\n### Free IP blocks calculation\n\nCompute the best possible aligned IP blocks within a given range,\nexcluding the taken blocks or IP addresses.\n\nExample:\n```php\n$block = '192.168.0.0/24';\n$taken = ['192.168.0.64/28'];\n\n$calculator = new IpBlocksCalculator();\n$free = $calculator-\u003e__invoke($block, $taken);\n\nvar_dump($free);\n/*\n *  [\n *    '192.168.0.0/26',\n *    '192.168.0.80/28',\n *    '192.168.0.96/27',\n *    '192.168.0.128/25',\n *   ]\n */\n```\n\nSee more examples in [IpBlocksCalculatorTest](blob/master/tests/Unit/IpBlocksCalculatorTest.php).\n\n\n### IP ranges parsing\n\nParse fuzzy IP address block definitions and unwrap it to an array:\n\nExample:\n```php\nIpRangeParser::fromString('192.0.2.[1,2,100-250]/24');\n// ['192.0.2.1/24', '192.0.2.2/24', '192.0.2.100/24' ... '192.0.2.250/24']\n```\n\nSee more examples in [IpRangeParserTest](blob/master/tests/Unit/IpRangeParseTest.php).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhiqdev%2Fphp-ip-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhiqdev%2Fphp-ip-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhiqdev%2Fphp-ip-tools/lists"}