PHP code example of roomies / geolocatable

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

    

roomies / geolocatable example snippets


use Roomies\Geolocatable\Facades\Geolocation;

// Returns an instance of \Roomies\Geolocatable\Result\Geolocation
$result = Geolocate::ip('129.168.0.1');

echo "Looks like you are in {$result->country}, roughly around {$result->latitude}, {$result->longitude}.";

Geolocate::using('maxmind_database')->ip('192.168.0.1');

$result = new Roomies\Geolocatable\Result\Geolocation(
    source: 'fake',
    ipAddress: '192.168.0.1',
    raw: []
);

Geolocate::fake($result);
bash
php artisan vendor:publish --tag="geolocatable-config"