{"id":13616518,"url":"https://github.com/ipdata/php","last_synced_at":"2025-07-03T22:04:15.130Z","repository":{"id":48077690,"uuid":"236148947","full_name":"ipdata/php","owner":"ipdata","description":"Official PHP client library for the ipdata API","archived":false,"fork":false,"pushed_at":"2021-08-08T14:26:42.000Z","size":23,"stargazers_count":18,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-16T10:42:44.211Z","etag":null,"topics":["geolocation","ipdata"],"latest_commit_sha":null,"homepage":"https://ipdata.co","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/ipdata.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2020-01-25T09:20:38.000Z","updated_at":"2024-01-16T23:05:51.000Z","dependencies_parsed_at":"2022-08-12T18:10:15.048Z","dependency_job_id":null,"html_url":"https://github.com/ipdata/php","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ipdata/php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipdata%2Fphp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipdata%2Fphp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipdata%2Fphp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipdata%2Fphp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ipdata","download_url":"https://codeload.github.com/ipdata/php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipdata%2Fphp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260310621,"owners_count":22989841,"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":["geolocation","ipdata"],"created_at":"2024-08-01T20:01:29.646Z","updated_at":"2025-07-03T22:04:14.611Z","avatar_url":"https://github.com/ipdata.png","language":"PHP","readme":"# Ipdata.co API client for PHP\n\nAn API client to communicate with Ipdata.co.\n\n## Install\n\n```\ncomposer require ipdata/api-client\n```\n\nThe client is built upon PSR standards. We use PSR-18 for HTTP client and PSR-17 \nfor RequestFactory. These needs to be passed to the client's constructor. \n\nExample packages for PSR-17 and PSR-18:\n\n```\ncomposer require nyholm/psr7 symfony/http-client\n```\n\n```php\nuse Ipdata\\ApiClient\\Ipdata;\nuse Symfony\\Component\\HttpClient\\Psr18Client;\nuse Nyholm\\Psr7\\Factory\\Psr17Factory;\n\n$httpClient = new Psr18Client();\n$psr17Factory = new Psr17Factory();\n$ipdata = new Ipdata('my_api_key', $httpClient, $psr17Factory);\n```\n\n## How to use\n\nTo send a geocode request you simply need to provide the IP address you are interested in. \n\n```php\n$data = $ipdata-\u003elookup('69.78.70.144');\necho json_encode($data, JSON_PRETTY_PRINT);\n```\n\nThe output will be the response from the API server with one additional `status` field. \n\n```json\n{\n    \"ip\": \"69.78.70.144\",\n    \"is_eu\": false,\n    \"city\": null,\n    \"region\": null,\n    \"region_code\": null,\n    \"country_name\": \"United States\",\n    \"country_code\": \"US\",\n    \"continent_name\": \"North America\",\n    \"continent_code\": \"NA\",\n    \"latitude\": 37.751,\n    \"longitude\": -97.822,\n    \"postal\": null,\n    \"calling_code\": \"1\",\n    \"flag\": \"https:\\/\\/ipdata.co\\/flags\\/us.png\",\n    \"emoji_flag\": \"\\ud83c\\uddfa\\ud83c\\uddf8\",\n    \"emoji_unicode\": \"U+1F1FA U+1F1F8\",\n    \"asn\": {\n        \"asn\": \"AS6167\",\n        \"name\": \"Cellco Partnership DBA Verizon Wireless\",\n        \"domain\": \"verizonwireless.com\",\n        \"route\": \"69.78.0.0\\/16\",\n        \"type\": \"business\"\n    },\n    \"carrier\": {\n        \"name\": \"Verizon\",\n        \"mcc\": \"310\",\n        \"mnc\": \"004\"\n    },\n    \"languages\": [\n        {\n            \"name\": \"English\",\n            \"native\": \"English\"\n        }\n    ],\n    \"currency\": {\n        \"name\": \"US Dollar\",\n        \"code\": \"USD\",\n        \"symbol\": \"$\",\n        \"native\": \"$\",\n        \"plural\": \"US dollars\"\n    },\n    \"time_zone\": {\n        \"name\": \"America\\/Chicago\",\n        \"abbr\": \"CST\",\n        \"offset\": \"-0600\",\n        \"is_dst\": false,\n        \"current_time\": \"2020-01-25T06:14:37.081772-06:00\"\n    },\n    \"threat\": {\n        \"is_tor\": false,\n        \"is_proxy\": false,\n        \"is_anonymous\": false,\n        \"is_known_attacker\": false,\n        \"is_known_abuser\": false,\n        \"is_threat\": false,\n        \"is_bogon\": false\n    },\n    \"count\": \"6\",\n    \"status\": 200\n}\n```\n\nIf you are not interested in all the fields in the response, you may query only\nthe fields you want. \n\n```php\n$data = $ipdata-\u003elookup('69.78.70.144', ['longitude', 'latitude', 'country_name']);\necho json_encode($data, JSON_PRETTY_PRINT);\n```\n\n```json\n{\n    \"longitude\": -97.822,\n    \"latitude\": 37.751,\n    \"country_name\": \"United States\",\n    \"status\": 200\n}\n```\n\n### Bulk request\n\nIf you want to look up multiple IPs at the same time you may use the `bulkLookup()` function.\n\n\n```php\n$data = $ipdata-\u003ebuildLookup(['1.1.1.1', '69.78.70.144'], ['longitude', 'latitude', 'country_name']);\necho json_encode($data, JSON_PRETTY_PRINT);\n```\n\n```json\n{\n    \"0\": {\n        \"longitude\": 143.2104,\n        \"latitude\": -33.494,\n        \"country_name\": \"Australia\"\n    },\n    \"1\": {\n        \"longitude\": -97.822,\n        \"latitude\": 37.751,\n        \"country_name\": \"United States\"\n    },\n    \"status\": 200\n}\n```\n\n## Available Fields\n\nA list of all the fields returned by the API is maintained at [Response Fields](https://docs.ipdata.co/api-reference/response-fields)\n\n## Errors\n\nA list of possible errors is available at [Status Codes](https://docs.ipdata.co/api-reference/status-codes)\n","funding_links":[],"categories":["PHP"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fipdata%2Fphp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fipdata%2Fphp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fipdata%2Fphp/lists"}