PHP code example of statsig / ip3country

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

    

statsig / ip3country example snippets


// import
untry\IP3Country;

// Initialize
$ip3c = new IP3Country();

// Lookup using ip4 str
echo $ip3c->lookup("1.1.1.1"); // 'US'
echo $ip3c->lookup("123.45.67.8"); // 'KR'

// Lookup using numeric ip
echo ip3country.lookupNumeric(2066563848)); // 'KR'
bash
./vendor/bin/phpunit tests/TestCountries.php