{"id":36994058,"url":"https://github.com/jetcod/ip-intelligence","last_synced_at":"2026-01-13T23:46:16.715Z","repository":{"id":149904568,"uuid":"618902934","full_name":"jetcod/ip-intelligence","owner":"jetcod","description":"A PHP package for geolocating IP addresses and obtaining locale and language information from them.","archived":false,"fork":false,"pushed_at":"2024-08-31T14:21:25.000Z","size":1062,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-03T19:43:27.183Z","etag":null,"topics":["cldr","geolocation","ip-geolocation","language-detection","localization","maxmind"],"latest_commit_sha":null,"homepage":"https://jetcod.github.io/ip-intelligence/","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/jetcod.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,"governance":null}},"created_at":"2023-03-25T17:23:48.000Z","updated_at":"2024-11-25T16:20:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"30e941e1-31f7-4a7f-ad56-a1a79d723880","html_url":"https://github.com/jetcod/ip-intelligence","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/jetcod/ip-intelligence","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jetcod%2Fip-intelligence","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jetcod%2Fip-intelligence/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jetcod%2Fip-intelligence/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jetcod%2Fip-intelligence/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jetcod","download_url":"https://codeload.github.com/jetcod/ip-intelligence/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jetcod%2Fip-intelligence/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28405303,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cldr","geolocation","ip-geolocation","language-detection","localization","maxmind"],"created_at":"2026-01-13T23:46:16.622Z","updated_at":"2026-01-13T23:46:16.703Z","avatar_url":"https://github.com/jetcod.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# IP-Intelligence\n\n[![Actions Status](https://github.com/jetcod/ip-intelligence/actions/workflows/php.yml/badge.svg?style=for-the-badge\u0026label=%3Cb%3EBuild%3C/b%3E)](https://github.com/jetcod/ip-intelligence/actions)\n\n\n[![Latest Stable Version](https://poser.pugx.org/jetcod/ip-intelligence/v?style=for-the-badge)](https://packagist.org/packages/jetcod/ip-intelligence)\n[![License](http://poser.pugx.org/jetcod/ip-intelligence/license?style=for-the-badge)](https://packagist.org/packages/jetcod/ip-intelligence)\n\n\n## Overview\nIP-Intelligence is a versatile PHP library designed for comprehensive IP address intelligence analysis. Powered by the robust MaxMind database and seamlessly integrated with the CLDR (Common Locale Data Repository) package, this library empowers you to extract a wealth of information from an IP address. Whether you need to uncover geolocation data, ASN (Autonomous System Number) information, or even detect the language and locale associated with an IP address, IP-Intelligence provides the essential tools to enrich your data analysis and decision-making processes.\n\n## Requirements\nThis library requires:\n\n- php7.4 or 8.0+\n- Maxmind Db (available at [MaxMind Website](https://dev.maxmind.com/geoip))\n\nOnce you installed Maxmind Db you will have 3 database files as follows:\n\n- GeoLite2-Country.mmdb\n- GeoLite2-City.mmdb\n- GeoLite2-ASN.mmdb\n\nKeep the path to each file for further installation.\n\nFor comprehensive guidance on the installation procedure and requirements, kindly consult the [documentation website](https://jetcod.github.io/ip-intelligence/requirements.html).\n\n## Installation Guide\n\n### Step1: Composer Installation\n\nStart by installing the IP-Intelligence package via Composer. Run the following command in your terminal:\n\n```bash\ncomposer require jetcod/ip-intelligence\n```\n\nThis will fetch and install the necessary package files.\n\n### Step 2: Configuration \nIP-Intelligence requires configuration to work effectively. This library offers an artisan command tailored for Laravel projects, streamlining the installation and configuration of necessary databases. To kickstart this process, simply execute the following artisan command:\n\n```bash\nphp artisan IpIntelligence:data-install\n```\n\nThroughout this setup, you will be prompted to specify the paths to the Maxmind databases, and the associated environment variables will be automatically configured. \n\nIf your project falls outside the Laravel framework, you should incorporate the `cldr-core` package by executing:\n\n```bash\nnpm install cldr-core\n```\n\nSubsequently, make sure to define these variables within your `.env` file:\n\n## Usage\n\n### IP Lookup\nThe primary functionality of this library is to perform IP address lookups. You can obtain various details about an IP address using the ip() method. Here's an example of how to use it:\n\n\n```php\n\u003c?php\n\nnamespace App\\Http\\Controllers;\n\nuse Jetcod\\IpIntelligence\\GeoIpLookup;\n\nclass TestController\n{\n    public function __invoke(GeoIpLookup $lookup)\n    {\n        $address = '206.47.249.128';\n\n        try {\n            $ip = $lookup-\u003eip($address);\n\n            // Retrieve Language Information\n            $officialLanguages = $ip-\u003elanguage()-\u003eofficials();\n            // Returns an array of official languages spoken in the region, e.g., ['en', 'fr']\n\n            $allLanguages = $ip-\u003elanguage()-\u003eall();\n            // Returns an array of all languages spoken in the region, e.g., ['ar', 'atj', 'bla', 'bn', ...]\n\n            $locale = $ip-\u003elanguage()-\u003elocale;\n            // Returns the locale for the region, e.g., 'en_CA'\n\n            // Retrieve City Information\n            $cityName = $ip-\u003ecity()-\u003ename;\n            // Returns the name of the city, e.g., 'Toronto'\n\n            // Retrieve Country Information\n            $countryName = $ip-\u003ecountry()-\u003ename;\n            // Returns the name of the country, e.g., 'Canada'\n\n            dd(\n                \"IP Address: $address\",\n                \"Official Languages: \" . implode(', ', $officialLanguages),\n                \"All Languages: \" . implode(', ', $allLanguages),\n                \"Locale: $locale\",\n                \"City Name: $cityName\",\n                \"Country Name: $countryName\"\n            );\n\n        } catch (\\Jetcod\\IpIntelligence\\Exceptions\\InvalidIpAddressException $e) {\n            // Handle the case where the provided IP address is invalid.\n            echo $e-\u003egetMessage();\n        } catch (\\GeoIp2\\Exception\\AddressNotFoundException $e) {\n            // Handle the case where the IP address is not found in the database.\n            echo $e-\u003egetMessage();\n        }\n    }\n}\n```\n\nThis code demonstrates how to initialize the IpLookup class, perform an IP lookup, and retrieve information about the given IP address, including language, city, and country details. Be sure to handle exceptions as shown in the code to gracefully manage errors that may arise during the lookup process.\n\n### Language\n\nThe `Language` class is a component of the Jetcod IP Intelligence library and is designed to provide information about languages spoken in a specific country based on CLDR (Common Locale Data Repository) data. This class allows you to retrieve details about the languages, official languages, and the locale associated with a given country code.\n\nHere is the usage example:\n\n```php\nuse Jetcod\\IpIntelligence\\Models\\Language;\nuse Jetcod\\IpIntelligence\\Exceptions\\LanguageNotFoundException;\nuse Symfony\\Component\\Dotenv\\Dotenv;\n\n// Create a Language instance for the United States ('US')\n$language = new Language('US');\n\ntry {\n    // Retrieve all languages spoken in the United States\n    $allLanguages = $language-\u003eall();\n\n    // Retrieve official and de facto official languages\n    $officialLanguages = $language-\u003eofficials();\n\n    // Retrieve the locale for the first official language\n    $locale = $language-\u003elocale();\n\n    // Print the retrieved data\n    print_r($allLanguages);\n    print_r($officialLanguages);\n    \n    echo \"Locale: $locale\";\n} catch (LanguageNotFoundException $e) {\n    echo $e-\u003egetMessage();\n}\n```\n\nThis usage example demonstrates how to create a Language instance, switch the country, and retrieve language information for that country. It also handles exceptions that may occur during the process.\n\n## Contributing\nIf you would like to contribute to this library, please fork the repository and submit a pull request. We welcome bug fixes, feature requests, and other contributions.\n\n## License\nThis library is released under the MIT License. Please see the LICENSE file for more information.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjetcod%2Fip-intelligence","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjetcod%2Fip-intelligence","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjetcod%2Fip-intelligence/lists"}