{"id":20103161,"url":"https://github.com/dotkernel/dot-geoip","last_synced_at":"2025-05-06T08:31:11.372Z","repository":{"id":36459785,"uuid":"222445249","full_name":"dotkernel/dot-geoip","owner":"dotkernel","description":"DotKernel component based on Maxmind's geoip2/geoip2 package, using their free GeoLite2 databases to provide geographical details about an IP address.","archived":false,"fork":false,"pushed_at":"2025-02-24T11:03:14.000Z","size":4353,"stargazers_count":5,"open_issues_count":1,"forks_count":2,"subscribers_count":4,"default_branch":"3.0","last_synced_at":"2025-04-26T18:16:50.688Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://docs.dotkernel.org/dot-geoip/","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/dotkernel.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":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-18T12:35:09.000Z","updated_at":"2025-02-24T11:01:38.000Z","dependencies_parsed_at":"2024-04-05T10:29:27.455Z","dependency_job_id":"599eeb30-c1e8-4724-b4f3-ab33f4621ef3","html_url":"https://github.com/dotkernel/dot-geoip","commit_stats":{"total_commits":18,"total_committers":8,"mean_commits":2.25,"dds":0.7777777777777778,"last_synced_commit":"67e7f4381bd448473525270c4cbc6a12bab3f088"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotkernel%2Fdot-geoip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotkernel%2Fdot-geoip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotkernel%2Fdot-geoip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotkernel%2Fdot-geoip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dotkernel","download_url":"https://codeload.github.com/dotkernel/dot-geoip/tar.gz/refs/heads/3.0","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252648573,"owners_count":21782405,"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-13T17:34:30.197Z","updated_at":"2025-05-06T08:31:11.359Z","avatar_url":"https://github.com/dotkernel.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dot-geoip\n\nDotkernel component to provide geographical details about an IP address\n\n\u003e dot-geoip is a wrapper on top of [maxmind/GeoIP2-php](https://github.com/maxmind/GeoIP2-php)\n\n## Documentation\n\nDocumentation is available at: https://docs.dotkernel.org/dot-geoip/.\n\n## Badges\n\n![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/dot-geoip)\n![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-geoip/3.9.0)\n\n[![GitHub issues](https://img.shields.io/github/issues/dotkernel/dot-geoip)](https://github.com/dotkernel/dot-geoip/issues)\n[![GitHub forks](https://img.shields.io/github/forks/dotkernel/dot-geoip)](https://github.com/dotkernel/dot-geoip/network)\n[![GitHub stars](https://img.shields.io/github/stars/dotkernel/dot-geoip)](https://github.com/dotkernel/dot-geoip/stargazers)\n[![GitHub license](https://img.shields.io/github/license/dotkernel/dot-geoip)](https://github.com/dotkernel/dot-geoip/blob/3.0/LICENSE)\n\n[![Build Static](https://github.com/dotkernel/dot-geoip/actions/workflows/continuous-integration.yml/badge.svg?branch=3.0)](https://github.com/dotkernel/dot-geoip/actions/workflows/continuous-integration.yml)\n[![codecov](https://codecov.io/gh/dotkernel/dot-geoip/graph/badge.svg?token=K473P7MDZ4)](https://codecov.io/gh/dotkernel/dot-geoip)\n[![PHPStan](https://github.com/dotkernel/dot-geoip/actions/workflows/static-analysis.yml/badge.svg?branch=3.0)](https://github.com/dotkernel/dot-geoip/actions/workflows/static-analysis.yml)\n\n## Install\n\nYou can install this library by running the following command:\n\n```shell\ncomposer require dotkernel/dot-geoip\n```\n\nIf your application didn't already use it, the above command also installed [dotkernel/dot-cli](https://github.com/dotkernel/dot-cli).\nIn this case, see it's [README](https://github.com/dotkernel/dot-cli/blob/3.0/README.md) file on how to use it.\n\nCopy config file `vendor/dotkernel/dot-geoip/config/autoload/geoip.global.php` into your application's `config/autoload` directory.\n\nRegister the library's ConfigProvider by adding the following line to your application's `config/config.php` file:\n\n```php\nDot\\GeoIP\\ConfigProvider::class,\n```\n\nRegister the library's synchronizer command by adding the following line to your application's `config/autoload/cli.global.php` file under the `commands` array key:\n\n```php\nDot\\GeoIP\\Command\\GeoIpCommand::getDefaultName() =\u003e Dot\\GeoIP\\Command\\GeoIpCommand::class,\n```\n\n## Manage GeoLite2 database\n\nYou can download/update a specific GeoLite2 database, by running the following command:\n\n```shell\nphp ./bin/cli.php geoip:synchronize -d {DATABASE}\n```\n\nWhere _{DATABASE}_ takes one of the following values: `asn`, `city`, `country`.\n\nYou can download/update all GeoLite2 databases at once, by running the following command:\n\n```shell\nphp ./bin/cli.php geoip:synchronize\n```\n\nThe output should be similar to the below, displaying per row: `database identifier`: `previous build datetime` -\u003e `current build datetime`.\n\n```text\nasn: n/a -\u003e 2021-07-01 02:09:34\ncity: n/a -\u003e 2021-07-01 02:09:20\ncountry: n/a -\u003e 2021-07-01 02:05:12\n```\n\nGet help for this command by running `php ./bin/cli.php help geoip:synchronize`.\n\n\u003e If you set up the synchronizer command as a cronjob, you can add the `-q|--quiet` option, and it will output data only if an error has occurred.\n\n## Usage\n\nBelow is an example implementation of using DotGeoip to retrieve information about an IP address.\n\n```php\n\u003c?php\n\ndeclare(strict_types=1);\n\nnamespace Api\\Example\\Service;\n\nuse Dot\\GeoIP\\Service\\LocationServiceInterface;\nuse Throwable;\n\n/**\n * Class ExampleService\n * @package Api\\Example\\Service\n */\nclass ExampleService\n{\n    protected LocationServiceInterface $locationService;\n\n    /**\n     * ExampleService constructor.\n     * @param LocationServiceInterface $locationService\n     */\n    public function __construct(LocationServiceInterface $locationService)\n    {\n        $this-\u003elocationService = $locationService;\n    }\n\n    /**\n     * @param string $ipAddress\n     * @return object\n     */\n    public function myMethod(string $ipAddress): object\n    {\n        try {\n            // You can use any of the below methods:\n            \n            // Get CountryData which includes isEuMember, isoCode and name\n            return $this-\u003elocationService-\u003egetCountry($ipAddress);\n            \n            // Get ContinentData which includes code and name\n            return $this-\u003elocationService-\u003egetContinent($ipAddress);\n            \n            // Get OrganizationData which includes asn and name\n            return $this-\u003elocationService-\u003egetOrganization($ipAddress);\n\n            // Get LocationData which includes all of the above + estimated coordinates + timezone\n            return $this-\u003elocationService-\u003egetLocation($ipAddress);\n        } catch (Throwable $exception) {\n            // handle errors\n        }\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotkernel%2Fdot-geoip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdotkernel%2Fdot-geoip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotkernel%2Fdot-geoip/lists"}