<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Hussain Abid</title>
    <description>The latest articles on DEV Community by Hussain Abid (@hussainabid).</description>
    <link>https://dev.to/hussainabid</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F297991%2Fda1386bd-e4ec-45a9-bca0-5597cbabfd1c.png</url>
      <title>DEV Community: Hussain Abid</title>
      <link>https://dev.to/hussainabid</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hussainabid"/>
    <language>en</language>
    <item>
      <title>How to get current user location, city, country in laravel</title>
      <dc:creator>Hussain Abid</dc:creator>
      <pubDate>Thu, 29 Jul 2021 19:26:59 +0000</pubDate>
      <link>https://dev.to/hussainabid/how-to-get-current-user-location-city-country-in-laravel-dec</link>
      <guid>https://dev.to/hussainabid/how-to-get-current-user-location-city-country-in-laravel-dec</guid>
      <description>&lt;p&gt;In this tutorial, we will see how you can get the current user location, city, country, country code, postal code, zip code, region, longitude and latitude using IP Address in laravel.&lt;/p&gt;

&lt;p&gt;So we will be using stevebauman/location package in order to get that information.&lt;/p&gt;

&lt;p&gt;So let’s get started.&lt;/p&gt;

&lt;h1&gt;
  
  
  Step 1: Install Laravel
&lt;/h1&gt;

&lt;p&gt;First, we will install laravel into the project. I am installing it in user_location folder.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;composer create-project --prefer-dist laravel/laravel user_location
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Step 2: Install stevebauman/location package
&lt;/h1&gt;

&lt;p&gt;Then we need to install the stevebauman/location package.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;composer require stevebauman/location
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Step 3: Add the Service Provider and Alias
&lt;/h1&gt;

&lt;p&gt;Then we need to add the service provider in config/app.php in providers array:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Stevebauman\Location\LocationServiceProvider::class,
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And also add following alias in aliases in config/app.php:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;'Location' =&amp;gt; Stevebauman\Location\Facades\Location,
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So your final providers array will look like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VRBWN1y5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0vadhopzw0riuyv3n7qc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VRBWN1y5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0vadhopzw0riuyv3n7qc.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And aliases array will look like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YQnL5hoV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9sjktzzhgus3edtaobp9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YQnL5hoV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9sjktzzhgus3edtaobp9.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://impulsivecode.com/get-current-user-location-city-country-in-laravel/"&gt;Read Complete Blog Post Here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>geolocation</category>
      <category>programming</category>
      <category>php</category>
    </item>
  </channel>
</rss>
