PHP code example of chintanlin / laravel-geoip2

1. Go to this page and download the library: Download chintanlin/laravel-geoip2 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/ */

    

chintanlin / laravel-geoip2 example snippets


    GeoIP2::getCountry('8.8.8.8');  // Facades
    app('geoip2')->getCountry('8.8.8.8'); // Providers
    geoip2('8.8.8.8'); // helpers
    
    // use maxmind/GeoIP2 PHP API directly
    $record = GeoIP2::city('8.8.8.8'); 
    $record->country->name;

 bash
    php artisan geoip2:update;