{"id":20056264,"url":"https://github.com/chialab/php-ip","last_synced_at":"2025-05-05T14:30:21.635Z","repository":{"id":63571493,"uuid":"568786471","full_name":"chialab/php-ip","owner":"chialab","description":"Minimal PHP library to manage IP addresses, subnets, netmasks, etc. without additional dependencies","archived":false,"fork":false,"pushed_at":"2023-03-06T22:10:09.000Z","size":89,"stargazers_count":4,"open_issues_count":4,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-22T19:47:48.468Z","etag":null,"topics":["cidr-notation","internet-protocol","ip-address","php","php7","php8"],"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/chialab.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":"2022-11-21T12:08:12.000Z","updated_at":"2022-11-22T14:37:50.000Z","dependencies_parsed_at":"2023-02-10T06:15:44.881Z","dependency_job_id":null,"html_url":"https://github.com/chialab/php-ip","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chialab%2Fphp-ip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chialab%2Fphp-ip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chialab%2Fphp-ip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chialab%2Fphp-ip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chialab","download_url":"https://codeload.github.com/chialab/php-ip/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252514723,"owners_count":21760422,"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-notation","internet-protocol","ip-address","php","php7","php8"],"created_at":"2024-11-13T12:52:59.314Z","updated_at":"2025-05-05T14:30:21.320Z","avatar_url":"https://github.com/chialab.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"IP Address library for PHP\n==========================\n\n[![Run tests](https://github.com/chialab/php-ip/actions/workflows/test.yml/badge.svg)](https://github.com/chialab/php-ip/actions/workflows/test.yml)\n[![codecov](https://codecov.io/gh/chialab/php-ip/branch/main/graph/badge.svg?token=T3LTGXYGOJ)](https://codecov.io/gh/chialab/php-ip)\n\nThis library for PHP 7.4+ builds an abstraction over management of\nInternet Protocol versions, addresses and CIDR blocks.\n\nUsing this library makes it easy to check if an IP address belongs to a subnet or not.\n\n## Installation\n\nInstalling this library can be done via Composer:\n\n```console\n$ composer require chialab/ip\n```\n\n## Usage\n\n```php\nuse Chialab\\Ip;\n\n$address = Ip\\Address::parse('192.168.1.1');\nvar_dump($address-\u003egetProtocolVersion() === Ip\\ProtocolVersion::ipv4()); // bool(true)\nvar_dump($address-\u003egetProtocolVersion() === Ip\\ProtocolVersion::ipv6()); // bool(false)\n\n$subnet = Ip\\Subnet::parse('fec0::1/16');\nvar_dump((string)$subnet-\u003egetFirstAddress()); // string(6): \"fec0::\"\nvar_dump((string)$subnet-\u003egetNetmask()); // string(6) \"ffff::\"\nvar_dump($subnet-\u003econtains($address)); // bool(false)\nvar_dump($subnet-\u003econtains(Ip\\Address::parse('fec0:fe08:0123:4567:89ab:cdef:1234:5678'))); // bool(true)\nvar_dump($subnet-\u003ehasSubnet(Ip\\Subnet::parse('fec0:fe08::/32'))); // bool(true)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchialab%2Fphp-ip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchialab%2Fphp-ip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchialab%2Fphp-ip/lists"}