PHP code example of movemoveapp / laravel-maxmind

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

    

movemoveapp / laravel-maxmind example snippets


...
'providers' => [
    // Other providers...
    MoveMoveApp\Maxmind\MaxmindServiceProvider::class,
],






return [
    // Other providers...
    MoveMoveApp\Maxmind\MaxmindServiceProvider::class,
];



...
## Maxmind
MAXMIND_ISP_AS_ORGANIZATION=X-ISP-AS-Organization
MAXMIND_ISP_AS=X-ISP-AS
MAXMIND_ISP_ORGANIZATION=X-ISP-Organization
MAXMIND_ISP_NAME=X-ISP-Name
MAXMIND_CONNECTION_TYPE=X-Connection-Type
MAXMIND_POSTAL_CONFIDENCE=X-Postal-Confidence
MAXMIND_POSTAL_CODE=X-Postal-Code
MAXMIND_METRO_CODE=X-Metro-Code
MAXMIND_TIME_ZONE=X-Time-Zone
MAXMIND_LONGITUDE=X-Longitude
MAXMIND_LATITUDE=X-Latitude
MAXMIND_AVERAGE_INCOME=X-Average-Income
MAXMIND_ACCURACY_RADIUS=X-Accuracy-Radius
MAXMIND_CITY_CODE=X-City-Code
MAXMIND_CITY_NAME=X-City-Name
MAXMIND_REGION_CODE=X-Region-Code
MAXMIND_REGION_ISO=X-Region-Iso
MAXMIND_REGION_NAME=X-Region-Name
MAXMIND_COUNTRY_CODE=X-Country-Code
MAXMIND_COUNTRY_ISO=X-Country-Iso
MAXMIND_COUNTRY_NAME=X-Country-Name
MAXMIND_CONTINENT_CODE=X-Continent-Code
MAXMIND_CONTINENT_ISO=X-Continent-Iso
MAXMIND_CONTINENT_NAME=X-Continent-Name

...

Route::get('/debug-geo', function (\Illuminate\Http\Request $request) {
    return request()->server();
});


use MoveMoveApp\Maxmind\Enums\NetworkType;

...

$ip = '2001:0db8:85a3::8a2e:0370:7334';

$type = detectIpType($ip);

if ($type === NetworkType::IPV6) {
    echo "IPv6 address detected.";
} elseif ($type === NetworkType::IPV4) {
    echo "IPv4 address detected.";
} else {
    echo "Invalid IP address.";
}

shell
php artisan vendor:publish --provider='MoveMoveApp\Maxmind\MaxmindServiceProvider'