{"id":15984936,"url":"https://github.com/divineomega/laravel-geolocation-request","last_synced_at":"2025-03-18T01:30:25.706Z","repository":{"id":56969661,"uuid":"195302307","full_name":"DivineOmega/laravel-geolocation-request","owner":"DivineOmega","description":"Laravel Geolocation Request","archived":false,"fork":false,"pushed_at":"2021-02-15T15:53:57.000Z","size":11,"stargazers_count":4,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T06:04:26.633Z","etag":null,"topics":["countries","geolocation","laravel-package","laravel-request"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DivineOmega.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":"2019-07-04T21:21:13.000Z","updated_at":"2021-02-15T15:53:18.000Z","dependencies_parsed_at":"2022-08-21T06:40:21.137Z","dependency_job_id":null,"html_url":"https://github.com/DivineOmega/laravel-geolocation-request","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DivineOmega%2Flaravel-geolocation-request","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DivineOmega%2Flaravel-geolocation-request/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DivineOmega%2Flaravel-geolocation-request/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DivineOmega%2Flaravel-geolocation-request/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DivineOmega","download_url":"https://codeload.github.com/DivineOmega/laravel-geolocation-request/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243893849,"owners_count":20364918,"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":["countries","geolocation","laravel-package","laravel-request"],"created_at":"2024-10-08T02:11:28.159Z","updated_at":"2025-03-18T01:30:25.386Z","avatar_url":"https://github.com/DivineOmega.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel Geolocation Request\n\nThe Laravel Geolocation Request package provides an easy\nway to geolocate requests to their country of origin, simply\nby calling a `$request-\u003ecountry()` method.\n\n## Installation\n\nTo install the Laravel Geolocation Request package, just\nrun the following Composer command.\n\n```bash\ncomposer require divineomega/laravel-geolocation-request\n``` \n\n## Usage\n\nTo use geolocation enabled requests within your Laravel controller \nmethods, you can replace the `use Illuminate\\Http\\Request` line \nat the top of your controllers, as shown in the usage example below.\n\nOnce done, you can simple call the `$request-\u003ecountry()` method to \nperform geolocation and return the origin country of the active \nrequest based on its IP address. The country is returned as an object \ncontaining many properties, such as the country name and ISO codes.\n\n```php\n\u003c?php\n\nnamespace App\\Http\\Controllers;\n\n//use Illuminate\\Http\\Request;\nuse DivineOmega\\LaravelGeolocationRequest\\Http\\Requests\\GeolocationRequest as Request;\n\nclass UserController extends Controller\n{\n    /**\n     * Store a new user.\n     *\n     * @param  Request  $request\n     * @return Response\n     */\n    public function store(Request $request)\n    {\n        // Perform geolocation, and return a country object.\n        $country = $request-\u003ecountry();\n        \n        $user = new \\App\\User();\n        $user-\u003ename = $request-\u003ename;\n        $user-\u003ecountryName = $country-\u003ename;\n        $user-\u003ecountryCode = $country-\u003eisoCodeAlpha3;\n        \n        $user-\u003esave();\n        \n        // ...\n    }\n}\n```\n\nIf you are using custom request objects, you can\nchange them to extend the provided `GeolocationRequest` class.\nIf you unable to extend your custom request object, or \nsimply do not wish to, you can add geolocation functionality\nby using the provided `GeolocatableRequest` trait.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdivineomega%2Flaravel-geolocation-request","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdivineomega%2Flaravel-geolocation-request","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdivineomega%2Flaravel-geolocation-request/lists"}