{"id":13560131,"url":"https://github.com/JCSama/CodeIgniter-geolocation","last_synced_at":"2025-04-03T15:31:38.306Z","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":32,"open_issues_count":0,"forks_count":18,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-02-15T12:31:47.355Z","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-02-11T19:15:50.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,"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","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247027964,"owners_count":20871630,"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-08-01T13:00:38.105Z","updated_at":"2025-04-03T15:31:33.283Z","avatar_url":"https://github.com/JCSama.png","language":"PHP","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","funding_links":[],"categories":["Libraries"],"sub_categories":[],"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"}