PHP code example of interaction-design-foundation / laravel-geoip

1. Go to this page and download the library: Download interaction-design-foundation/laravel-geoip library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

interaction-design-foundation / laravel-geoip example snippets


// Get location for an IP
$location = geoip('203.0.113.1');

// Get location for the current visitor
$location = geoip()->getLocation();

// Access location data
$location->city;       // "New Haven"
$location->country;    // "United States"
$location->iso_code;   // "US"
$location->timezone;   // "America/New_York"
$location->currency;   // "USD"
sh
php artisan vendor:publish --provider="InteractionDesignFoundation\GeoIP\GeoIPServiceProvider" --tag=config
sh
# Download/update the local GeoIP database (tions
php artisan geoip:clear