{"id":19292558,"url":"https://github.com/paramonovav/geoip","last_synced_at":"2026-05-17T19:09:05.906Z","repository":{"id":98289842,"uuid":"46519735","full_name":"paramonovav/geoip","owner":"paramonovav","description":null,"archived":false,"fork":false,"pushed_at":"2015-11-19T04:25:33.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-14T19:23:51.977Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":false,"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/paramonovav.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":"2015-11-19T20:54:20.000Z","updated_at":"2022-05-08T17:23:39.000Z","dependencies_parsed_at":"2023-03-12T03:46:19.600Z","dependency_job_id":null,"html_url":"https://github.com/paramonovav/geoip","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/paramonovav/geoip","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paramonovav%2Fgeoip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paramonovav%2Fgeoip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paramonovav%2Fgeoip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paramonovav%2Fgeoip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paramonovav","download_url":"https://codeload.github.com/paramonovav/geoip/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paramonovav%2Fgeoip/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33151626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T09:28:26.183Z","status":"ssl_error","status_checked_at":"2026-05-17T09:27:52.702Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":[],"created_at":"2024-11-09T22:31:32.794Z","updated_at":"2026-05-17T19:09:05.877Z","avatar_url":"https://github.com/paramonovav.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Greenball GeoIP locator for Laravel 4.\n***\nThis package is able to locate an IPV4 Address geo position. The locating are driver based and the locator ships with multiple free API support such as **freegeoip.net**, **telize.com**, **smart-ip.net** and counting... With those APIs result builds an standard data schema and provides an easly managable information layer.\n\n### Features\n***\n\n+ Driver based locating.\n+ Locate address' country.\n+ Locate address' city.\n+ Locate address' latitude.\n+ Locate address' longitude.\n+ Look behind proxies.\n+ Easy costumization by a simple config file.\n+ **Import** \u0026 **Export** results into compact string.\n+ Out of the box **caching**!\n\n### Installation\n***\n\nFirst add the package to your composer:\n```json\n{\n    \"require\": {\n        \"greenball/geoip\": \"1.*\"\n    }\n}\n```\nAfter the composer update/install add the service provider to your app.php:\n```php\n'providers' =\u003e array(\n    // ...\n    'Greenball\\GeoIP\\Providers\\GeoIPServiceProvider',\n    // ...\n)\n```\nAdd the alias to the aliases in your app.php:\n```php\n'aliases' =\u003e array(\n    // ...\n    'GeoIP' =\u003e 'Greenball\\GeoIP\\Facades\\GeoIP',\n)\n```\nYou can use personal configurations just publish the package's configuration files.\n```php\nphp artisan config:publish greenball/geoip\n```\nFinaly, enjoy :3\n\n### Drivers\n***\nThe package ships with multiple free geo api driver. You just need to choose which service you prefer in the config file. Currently supported drivers:\n\n+ FreeGeoIP by [freegoip.net](http://freegoip.net/)\n+ SmartIP by [smart-ip.net](http://smart-ip.net/)\n+ Telize by [telize.com](http://telize.com/)\n\n*If you wana found any free api and wana see it in the package do a PR or make an Issue*\n\n### Usage\n***\n```php\n// Fetch the current visitor's geo location.\n$result \t= GeoIP::locate();\n\n// Every locating will product a standard data schema.\nGreenball\\GeoIP\\Result Object\n(\n    [ipaddress:protected] =\u003e 216.239.51.99\n    [attributes:protected] =\u003e Array\n        (\n            [countryCode] =\u003e US\n            [countryName] =\u003e United States\n            [regionName] =\u003e California\n            [city] =\u003e Mountain View\n            [zipcode] =\u003e \n            [latitude] =\u003e 37.4192\n            [longitude] =\u003e -122.057\n            [areaCode] =\u003e \n        )\n\n)\n\n// Locate a stored IP address.\nGeoIP::locate('86.89.95.124');\n\n// Import results from database varchar field.\nGeoIP::importFromString('US|United States|California|Mountain View||37.4192|-122.057|');\n\n// Export results to compact string.\n$string = (string) GeoIP::locate();\n$string = GeoIP::toString();\necho GeoIP::locate();\n\n// The result also implements the ArrayIterator so can use like this.\nforeach(GeoIP::locate('178.88.16.44') as $key =\u003e $value) {\n    echo 'Your '.$key.' is '.var_export($value, true).'.\u003cbr\u003e';\n}\n```\n\n### Examples\n***\nThe Locator facade useing magic calls for easier codeing, every function request will be mirrored to the result object.\n\n```php\n// Get the visitors city name.\necho 'You visiting from '.GeoIP::city();\n\n// Get geo position.\necho 'Your latitude is '.GeoIP::latitude().' and longitude is '.GeoIP::longitude();\n```\n\nYou can use the countryCode to deliver the content in your visitor's language.\n```php\n// Ofc, its good idea to verify you support the language first but the mechanism is like this :3\nApp::setLocale(strtolower(GeoIP::countryCode()));\n```\n\n### Import \u0026 Export results\n***\nYou can export \u0026 import the result object informations into a simple array or a compact string. This function useful when you wish to store a result in a database field, the compact string format will only contain the result values so it can be between 30-200 chr which fits perfectly in your database char field.\n\n```php\n// Export to compact string.\nGeoIP::detect()-\u003etoString(); // Will produce US|United States|California|Mountain View||37.4192|-122.057|\n\n// Import from compact string.\nGeoIP::importFromString('PL|Poland|Lodzkie|Lodz||51.75|19.4667|');\n\n// Export result to an array.\n$infoArray = GeoIP::toArray(); // Will produce a simple array with the result object data values.\n\n// Import result from an array.\n// if you pass a numeric keyed array to the function that will \n// sniff it out and combine the schema keys and the imported data values to the object.\nGeoIP::importFromArray($infoArray); // Will revert every informations.\n\n// Also there is a base function which can sniff the\n// passed argument's type an call the right function for it.\nGeoIP::import('Can be string or an array here.');\n```\n\n### Results\n***\nThe package uses the Laravel framework's awesome IoC with this you can inject your own solutions.\n\n```php\n// Make the locator from it's container.\nApp::make('geoip')-\u003elocate();\n\n// Make an empty result object from the container.\nApp::make('geoip.result')\n    -\u003eimport('NO|Norway|Oslo|Christiania||59.9167|10.75|');\n\n// Inject your own result object.\nApp::bind('geoip.result', 'My\\Custom\\Result');\n```\n\n### Cacheing\n***\nThe package useing your running app's cache so you don't have to set up anything ;) Also it uses a really really small footprint with the compact string solution.\n\nCacheing in theory: the results are converted into an unindexed array in the standard schema's order, then remove the empty values like 0, false, null to save the unecessary zeros and that string will be imported \u0026 exported from / to cache. When the script imports a result from a string the result object uses the standard schema and converts the value types back.\n\n### Config\n***\n\n+ You can set a fallback IPV4 address for CLI request to not to cause conflicts.\n+ Filter reserved and private addresses.\n+ Driver which used on locating.\n+ Driver configs, if the driver require secret key or any config.\n+ Cache interval and key prefix.\n\n### Changes\n***\n\n+ 0.1.0 Result object become an instance of Illuminate\\Support\\Fluent for less codeing, fixed a locator bug on reflections, added and set the SmartIP as default driver.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparamonovav%2Fgeoip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparamonovav%2Fgeoip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparamonovav%2Fgeoip/lists"}