PHP code example of nawrasbukhari / geo-content

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

    

nawrasbukhari / geo-content example snippets


return [
    'freeipapi_base_url' => env('FREEIPAPI_BASE_URL', 'https://freeipapi.com/api/json/'),
    'freeipapi_key' => env('FREEIPAPI_KEY'),
    'freeipapi_ssl' => env('FREEIPAPI_SSL', false),
    'timeout' => env('FREEIPAPI_TIMEOUT', 30),
    'testing_ip_address' => env('FREEIPAPI_TESTING_IP_ADDRESS', '208.67.222.222'),
    'usual_localhost_ip' => [
        '127.0.0.1',
        '::1',
        'localhost',
    ],
];

use NawrasBukhari\GeoContent\Facades\GeoContent;

$geoContent = new GeoContent();

if ($geoContent->country('United States of America')) {
    // Display restricted content here
}

use NawrasBukhari\GeoContent\Facades\GeoContent;

$geoContent = new GeoContent();

if ($geoContent->continent('AM')) {
    // Display restricted content here
}

use NawrasBukhari\GeoContent\Facades\GeoContent;

// Create an instance of the GeoContent class
$geoContent = new GeoContent();

// Hide content from users in Russia
if ($geoContent->onlyShowInCountry('Russia')) {
    // Display non-restricted content here for users from Russia
}