PHP code example of zsping1989 / ip-city

1. Go to this page and download the library: Download zsping1989/ip-city 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/ */

    

zsping1989 / ip-city example snippets


  'MyLukin\IP2City\ServiceProvider',
  

  'IP2City' => 'MyLukin\IP2City\Facade',
  

 namespace App\Http\Controllers;

use IP2City;

class WelcomeController extends Controller {
    
    public function index()
    {
        var_dump(IP2City::ip2addr('115.28.212.163'));
    }
}
shell
  php artisan vendor:publish --provider="MyLukin\IP2City\ServiceProvider"