{"id":20262712,"url":"https://github.com/jcsama/codeigniter-geolocation","last_synced_at":"2025-09-07T20:14:04.154Z","repository":{"id":30241219,"uuid":"33792410","full_name":"JCSama/CodeIgniter-geolocation","owner":"JCSama","description":"CodeIgniter Geolocation library allows you to locate an IP Address using \"ipinfodb\" API.","archived":false,"fork":false,"pushed_at":"2015-08-03T15:17:34.000Z","size":174,"stargazers_count":31,"open_issues_count":0,"forks_count":17,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-11T01:52:18.762Z","etag":null,"topics":[],"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/JCSama.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-04-11T21:01:36.000Z","updated_at":"2024-12-02T18:30:43.000Z","dependencies_parsed_at":"2022-09-03T18:50:53.882Z","dependency_job_id":null,"html_url":"https://github.com/JCSama/CodeIgniter-geolocation","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/JCSama/CodeIgniter-geolocation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JCSama%2FCodeIgniter-geolocation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JCSama%2FCodeIgniter-geolocation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JCSama%2FCodeIgniter-geolocation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JCSama%2FCodeIgniter-geolocation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JCSama","download_url":"https://codeload.github.com/JCSama/CodeIgniter-geolocation/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JCSama%2FCodeIgniter-geolocation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274088625,"owners_count":25220260,"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","status":"online","status_checked_at":"2025-09-07T02:00:09.463Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-14T11:31:21.783Z","updated_at":"2025-09-07T20:14:04.120Z","avatar_url":"https://github.com/JCSama.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CodeIgniter Geolocation Library\n\nCodeIgniter Geolocation library allows you to locate an IP Address using \"ipinfodb\" API.\n\n# Installation\n\nCodeIgniter Versoin \u003e= 2.x.x\n\nCopy the file `config/geolocation.php` to the `application/config` folder.\n\nCopy the file `libraries/geolocation.php` to the `application/libraries` folder.\n\n# Usage\n\nYou need to subscribe to http://ipinfodb.com/register.php to get your API KEY and then,\n\nOpen `application/config/geolocation.php` and put it there :\n\n```php\n$config['api_key'] = 'YOUR_API_KEY';\n```\n\nAfter that, you can call the library within your controller for instance like following :\n\n```php\n$this-\u003eload-\u003elibrary('Geolocation');\n$this-\u003eload-\u003econfig('geolocation', true);\n\n$config = $this-\u003econfig-\u003econfig['geolocation'];\n\n$this-\u003egeolocation-\u003einitialize($config);\n$this-\u003egeolocation-\u003eset_ip_address($ip); // IP to locate\n// $this-\u003egeolocation-\u003eset_format('json');\n// OR you can change the format within `config/geolocation.php` config file\n$country = $this-\u003egeolocation-\u003eget_country();\nvar_dump($country);\n\n// For more precision\n$city = $this-\u003egeolocation-\u003eget_city();\nif($city === FALSE)\n    var_dump($this-\u003egeolocation-\u003eget_error());\nelse\n    var_dump($city);\n```\n\n# Additional parameters\n\nYou can change the result format within the config file,\nor leave it empty to return a PHP Array\n\nOpen `application/config/geolocation.php` :\n\n```php\n$config['format'] = 'json'; // available format : xml|raw|json  or empty for php array\n```\n\n# IpInfoDb API :\n\nFor more information about the API please visit : http://ipinfodb.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcsama%2Fcodeigniter-geolocation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjcsama%2Fcodeigniter-geolocation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcsama%2Fcodeigniter-geolocation/lists"}