PHP code example of kielabokkie / laravel-ipdata

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

    

kielabokkie / laravel-ipdata example snippets


'providers' => [
    // ...
    Kielabokkie\LaravelIpdata\IpdataServiceProvider::class,
]

'aliases' => [
    // ...
    'Ipdata' => Kielabokkie\LaravelIpdata\Facades\Ipdata::class,
)

// ...
'ipdata' => [
    'api_key' => env('IPDATA_API_KEY'),
],

use Kielabokkie\LaravelIpdata\Facades\Ipdata;

$res = Ipdata::lookup();

use Kielabokkie\LaravelIpdata\Facades\Ipdata;

$res = Ipdata::lookup('1.1.1.1');

echo $res->country_name; // Australia
echo $res->flag; // https://ipdata.co/flags/au.png