### Install GeoIP Location via Composer Source: https://github.com/victorybiz/geoip-location/blob/master/README.md Install the package using composer. This command adds the package to your project and updates the autoloader. ```bash composer require victorybiz/geoip-location ``` -------------------------------- ### Get Currency Information Source: https://context7.com/victorybiz/geoip-location/llms.txt Retrieves the local currency code and symbol for an IP address location. ```APIDOC ## GET /api/geoip/currency ### Description Returns the local currency code (ISO 4217) and symbol for the IP address location. ### Method GET ### Endpoint /api/geoip/currency ### Parameters #### Query Parameters - **ip** (string) - Required - The IP address to look up. ### Response #### Success Response (200) - **currency_code** (string) - The ISO 4217 currency code (e.g., "NGN"). - **currency_symbol** (string) - The currency symbol (e.g., "₦"). ### Response Example ```json { "currency_code": "NGN", "currency_symbol": "₦" } ``` ``` -------------------------------- ### Get Full Location String Source: https://github.com/victorybiz/geoip-location/blob/master/README.md Retrieve a formatted string containing the city, region, and country of the client's IP address. ```php echo $geoip->getLocation(); // Return client IP Location string (city, region, country) ``` -------------------------------- ### Retrieve City Information Source: https://context7.com/victorybiz/geoip-location/llms.txt Get the city name for the current IP, returning null if the location cannot be determined. ```php setIP('169.159.76.74'); $city = $geoip->getCity(); echo $city; // Output: "Lagos" // Handle cases where city is unknown if ($city !== null) { echo "Visitor is from: " . $city; } else { echo "City could not be determined"; } ``` -------------------------------- ### Complete Usage Example for GeoIP Location Source: https://context7.com/victorybiz/geoip-location/llms.txt Demonstrates how to initialize the GeoIPLocation class, set an IP address, and retrieve all available visitor location data. Ensure the vendor autoload file is included. ```php 'USD' ]); // Optionally set a specific IP (or let it auto-detect) $geoip->setIP('169.159.76.74'); // Retrieve all location data $visitorData = [ 'ip' => $geoip->getIP(), 'city' => $geoip->getCity(), 'region' => $geoip->getRegion(), 'region_code' => $geoip->getRegionCode(), 'country' => $geoip->getCountry(), 'country_code' => $geoip->getCountryCode(), 'continent' => $geoip->getContinent(), 'continent_code' => $geoip->getContinentCode(), 'postal_code' => $geoip->getPostalCode(), 'latitude' => $geoip->getLatitude(), 'longitude' => $geoip->getLongitude(), 'currency_code' => $geoip->getCurrencyCode(), 'currency_symbol' => $geoip->getCurrencySymbol(), 'exchange_rate' => $geoip->getCurrencyExchangeRate(), 'location_string' => $geoip->getLocation(), ]; print_r($visitorData); /* Output: Array ( [ip] => 169.159.76.74 [city] => Lagos [region] => Lagos [region_code] => Lagos [country] => Nigeria [country_code] => NG [continent] => Africa [continent_code] => AF [postal_code] => ... [latitude] => 6.4541 [longitude] => 3.3947 [currency_code] => NGN [currency_symbol] => ₦ [exchange_rate] => ... [location_string] => Lagos, Lagos, Nigeria ) */ ``` -------------------------------- ### Get Country Source: https://github.com/victorybiz/geoip-location/blob/master/README.md Retrieve the country of the client's IP address. ```php echo $geoip->getCountry(); // Return client IP Country ``` -------------------------------- ### Get City Source: https://github.com/victorybiz/geoip-location/blob/master/README.md Retrieve the city of the client's IP address. Returns null if the city cannot be determined. ```php echo $geoip->getCity(); // Return client IP City (null if none) ``` -------------------------------- ### Set and Get IP Address Source: https://github.com/victorybiz/geoip-location/blob/master/README.md You can set a specific IP address to retrieve its geographical location using the setIP() method, followed by other retrieval methods. ```php echo $geoip->setIP('0.0.0.0'); // Set an IP to get its geographical location ``` -------------------------------- ### Get Continent Source: https://github.com/victorybiz/geoip-location/blob/master/README.md Retrieve the continent of the client's IP address. ```php echo $geoip->getContinent(); // Return client IP Continent ``` -------------------------------- ### Get Location Source: https://context7.com/victorybiz/geoip-location/llms.txt Retrieves a formatted location string combining city, region, and country for an IP address. ```APIDOC ## GET /api/geoip/location ### Description Returns a formatted location string combining city, region, and country. Useful for displaying a complete location summary. ### Method GET ### Endpoint /api/geoip/location ### Parameters #### Query Parameters - **ip** (string) - Required - The IP address to look up. ### Response #### Success Response (200) - **location** (string) - The formatted location string (e.g., "City, Region, Country"). ### Response Example ```json { "location": "Lagos, Lagos, Nigeria" } ``` ``` -------------------------------- ### Get Country Code Source: https://github.com/victorybiz/geoip-location/blob/master/README.md Retrieve the country code of the client's IP address. ```php echo $geoip->getCountryCode(); // Return client IP Country Code ``` -------------------------------- ### Get Client IP Address Source: https://github.com/victorybiz/geoip-location/blob/master/README.md Retrieve the client's IP address using the getIP() method. This can be used after instantiating the GeoIPLocation class. ```php echo $geoip->getIP(); // Return client IP ``` -------------------------------- ### Get Continent Code Source: https://github.com/victorybiz/geoip-location/blob/master/README.md Retrieve the continent code of the client's IP address. ```php echo $geoip->getContinentCode(); // Return client IP Continent Code ``` -------------------------------- ### Get Postal Code Source: https://context7.com/victorybiz/geoip-location/llms.txt Retrieves the postal or zip code associated with an IP address location. ```APIDOC ## GET /api/geoip/postalcode ### Description Returns the postal/zip code associated with the IP address location. ### Method GET ### Endpoint /api/geoip/postalcode ### Parameters #### Query Parameters - **ip** (string) - Required - The IP address to look up. ### Response #### Success Response (200) - **postal_code** (string) - The postal or zip code of the IP address location. ### Response Example ```json { "postal_code": "94043" } ``` ``` -------------------------------- ### Get Latitude and Longitude Source: https://context7.com/victorybiz/geoip-location/llms.txt Retrieves the geographic coordinates (latitude and longitude) for a given IP address. ```APIDOC ## GET /api/geoip/coordinates ### Description Returns the geographic coordinates (latitude and longitude) for the IP address location. ### Method GET ### Endpoint /api/geoip/coordinates ### Parameters #### Query Parameters - **ip** (string) - Required - The IP address to look up. ### Response #### Success Response (200) - **latitude** (float) - The latitude of the IP address location. - **longitude** (float) - The longitude of the IP address location. ### Response Example ```json { "latitude": 6.4541, "longitude": 3.3947 } ``` ``` -------------------------------- ### Get Region Source: https://github.com/victorybiz/geoip-location/blob/master/README.md Retrieve the region of the client's IP address. Returns null if the region cannot be determined. ```php echo $geoip->getRegion(); // Return client IP Region (null if none) ``` -------------------------------- ### Get Currency Code Source: https://github.com/victorybiz/geoip-location/blob/master/README.md Retrieve the currency code of the client's IP address country. Returns null if the currency code cannot be determined. ```php echo $geoip->getCurrencyCode(); // Return client IP Country Currency Code (null if none) ``` -------------------------------- ### Get Latitude Source: https://github.com/victorybiz/geoip-location/blob/master/README.md Retrieve the latitude coordinate of the client's IP address. Returns null if the latitude cannot be determined. ```php echo $geoip->getLatitude(); // Return client IP Latitude (null if none) ``` -------------------------------- ### Get Currency Symbol Source: https://github.com/victorybiz/geoip-location/blob/master/README.md Retrieve the currency symbol of the client's IP address country. Returns null if the currency symbol cannot be determined. ```php echo $geoip->getCurrencySymbol(); // Return client IP Country Currency Symbol (null if none) ``` -------------------------------- ### Get Currency Exchange Rate Source: https://context7.com/victorybiz/geoip-location/llms.txt Retrieves the currency exchange rate from a configured base currency to the visitor's local currency. ```APIDOC ## GET /api/geoip/currency/exchange-rate ### Description Returns the currency exchange rate from the configured base currency to the visitor's local currency. The base currency defaults to USD but can be configured. ### Method GET ### Endpoint /api/geoip/currency/exchange-rate ### Parameters #### Query Parameters - **ip** (string) - Required - The IP address to look up. - **base_currency** (string) - Optional - The base currency for the exchange rate (defaults to USD). ### Response #### Success Response (200) - **exchange_rate** (float) - The exchange rate from the base currency to the local currency. - **local_currency_code** (string) - The currency code of the IP address location. ### Response Example ```json { "exchange_rate": 1.15, "local_currency_code": "EUR" } ``` ``` -------------------------------- ### Get Client IP in Laravel Source: https://github.com/victorybiz/geoip-location/blob/master/README.md In a Laravel project, you can use the GeoIPLocation facade to easily retrieve the client's IP address. ```php use GeoIPLocation; echo GeoIPLocation::getIP(); // Return client IP ``` -------------------------------- ### getCity() - Get City Name Source: https://context7.com/victorybiz/geoip-location/llms.txt Retrieves the name of the city associated with the IP address being looked up. If the city cannot be determined from the available data, it returns null. ```APIDOC ## getCity() ### Description Returns the city name associated with the IP address. Returns null if the city cannot be determined. ### Method `getCity(): ?string` ### Endpoint N/A (Class method) ### Response #### Success Response (200) - **city** (string|null) - The name of the city, or null if not found. ### Response Example ```php setIP('169.159.76.74'); $city = $geoip->getCity(); echo $city; // Output: "Lagos" // Handle cases where city is unknown if ($city !== null) { echo "Visitor is from: " . $city; } else { echo "City could not be determined"; } ``` ``` -------------------------------- ### Retrieve Continent Information Source: https://context7.com/victorybiz/geoip-location/llms.txt Get the continent name and code, useful for regional content delivery or CDN routing. ```php setIP('169.159.76.74'); $continent = $geoip->getContinent(); $continentCode = $geoip->getContinentCode(); echo "Continent: " . $continent; // Output: "Africa" echo "Continent Code: " . $continentCode; // Output: "AF" // Regional content delivery switch ($continentCode) { case 'EU': $cdnRegion = 'europe'; break; case 'NA': $cdnRegion = 'north-america'; break; default: $cdnRegion = 'global'; } ``` -------------------------------- ### Get Region Code Source: https://github.com/victorybiz/geoip-location/blob/master/README.md Retrieve the region code of the client's IP address. Returns null if the region code cannot be determined. ```php echo $geoip->getRegionCode(); // Return client IP Region Code (null if none) ``` -------------------------------- ### Get Longitude Source: https://github.com/victorybiz/geoip-location/blob/master/README.md Retrieve the longitude coordinate of the client's IP address. Returns null if the longitude cannot be determined. ```php echo $geoip->getLongitude(); // Return client IP Longitude (null if none) ``` -------------------------------- ### Get Postal Code Source: https://github.com/victorybiz/geoip-location/blob/master/README.md Retrieve the postal code of the client's IP address. Returns null if the postal code cannot be determined. ```php echo $geoip->getPostalCode(); // Return client IP Postal Code (null if none) ``` -------------------------------- ### getCountry() and getCountryCode() - Get Country Information Source: https://context7.com/victorybiz/geoip-location/llms.txt Retrieves the full name of the country and its ISO country code for the specified IP address. These methods are useful for localization and tailoring content. ```APIDOC ## getCountry() and getCountryCode() ### Description Returns the country name and ISO country code for the IP address. ### Method `getCountry(): ?string` `getCountryCode(): ?string` ### Endpoint N/A (Class method) ### Response #### Success Response (200) - **country** (string|null) - The name of the country, or null if not found. - **country_code** (string|null) - The ISO country code (e.g., US, NG), or null if not found. ### Response Example ```php setIP('169.159.76.74'); $country = $geoip->getCountry(); $countryCode = $geoip->getCountryCode(); echo "Country: " . $country; // Output: "Nigeria" echo "Country Code: " . $countryCode; // Output: "NG" // Use for localization if ($countryCode === 'US') { echo "Welcome, American visitor!"; } ``` ``` -------------------------------- ### Get Currency Exchange Rate Source: https://github.com/victorybiz/geoip-location/blob/master/README.md Retrieve the currency exchange rate of the client's IP address country against NGN. Returns null if the exchange rate cannot be determined. ```php echo $geoip->getCurrencyExchangeRate(); // Return client IP Country Currency Exchange Rate against NGN (null if none) ``` -------------------------------- ### getRegion() and getRegionCode() - Get Region Information Source: https://context7.com/victorybiz/geoip-location/llms.txt Retrieves the name of the region (state or province) and its corresponding code for the given IP address. Both methods return a string value. ```APIDOC ## getRegion() and getRegionCode() ### Description Returns the region (state/province) name and code associated with the IP address. ### Method `getRegion(): ?string` `getRegionCode(): ?string` ### Endpoint N/A (Class method) ### Response #### Success Response (200) - **region** (string|null) - The name of the region, or null if not found. - **region_code** (string|null) - The code of the region, or null if not found. ### Response Example ```php setIP('169.159.76.74'); $region = $geoip->getRegion(); $regionCode = $geoip->getRegionCode(); echo "Region: " . $region; // Output: "Lagos" echo "Region Code: " . $regionCode; // Output: "Lagos" ``` ``` -------------------------------- ### getIP() - Get Visitor IP Address Source: https://context7.com/victorybiz/geoip-location/llms.txt Retrieves the IP address that is currently being used for geolocation. This method automatically detects the visitor's IP address by examining various HTTP headers and supports configurations involving proxies and Cloudflare. ```APIDOC ## getIP() ### Description Returns the current IP address being used for geolocation. Automatically detects the visitor's IP from various headers including support for proxies and Cloudflare. ### Method `getIP(): string` ### Endpoint N/A (Class method) ### Response #### Success Response (200) - **ip_address** (string) - The detected IP address. ### Response Example ```php getIP(); echo $ip; // Output: "203.0.113.45" // Note: Localhost IPs (127.0.0.1, ::1, 192.168.65.0, 172.18.0.1) // are automatically replaced with a test IP (169.159.82.111) ``` ``` -------------------------------- ### getContinent() and getContinentCode() - Get Continent Information Source: https://context7.com/victorybiz/geoip-location/llms.txt Retrieves the name of the continent and its corresponding code for the IP address. The library supports all seven continents, providing codes like AF (Africa), AS (Asia), EU (Europe), NA (North America), OC (Australia/Oceania), SA (South America), and AN (Antarctica). ```APIDOC ## getContinent() and getContinentCode() ### Description Returns the continent name and code for the IP address. Supports all seven continents: Africa (AF), Antarctica (AN), Asia (AS), Europe (EU), Australia/Oceania (OC), North America (NA), and South America (SA). ### Method `getContinent(): ?string` `getContinentCode(): ?string` ### Endpoint N/A (Class method) ### Response #### Success Response (200) - **continent** (string|null) - The name of the continent, or null if not found. - **continent_code** (string|null) - The ISO continent code, or null if not found. ### Response Example ```php setIP('169.159.76.74'); $continent = $geoip->getContinent(); $continentCode = $geoip->getContinentCode(); echo "Continent: " . $continent; // Output: "Africa" echo "Continent Code: " . $continentCode; // Output: "AF" // Regional content delivery switch ($continentCode) { case 'EU': $cdnRegion = 'europe'; break; case 'NA': $cdnRegion = 'north-america'; break; default: $cdnRegion = 'global'; } ``` ``` -------------------------------- ### Use GeoIPLocation Facade in Laravel Source: https://context7.com/victorybiz/geoip-location/llms.txt Demonstrates static method access via the Laravel Facade. ```php json([ 'ip' => $ip, 'country' => $country, 'country_code' => $countryCode, 'city' => $city, 'location' => $location, ]); } } // For Laravel < 5.5, manually register in config/app.php: // 'providers' => [ // Victorybiz\\\GeoIPLocation\\\GeoIPLocationServiceProvider::class, // ], // 'aliases' => [ // 'GeoIPLocation' => Victorybiz\\\GeoIPLocation\\\Facades\\\GeoIPLocationFacade::class, // ] ``` -------------------------------- ### GeoIPLocation Class Constructor Source: https://context7.com/victorybiz/geoip-location/llms.txt Instantiate the GeoIPLocation class. You can provide configuration options to set a specific IP address for lookup or define a base currency for exchange rate calculations. If no IP is provided, it defaults to auto-detecting the visitor's IP. ```APIDOC ## GeoIPLocation Class Constructor ### Description The main class for IP geolocation. Instantiate with optional configuration to set a specific IP address and base currency for exchange rates. ### Method `__construct(array $config = [])` ### Parameters #### Request Body - **ip** (string) - Optional - Specific IP to lookup (default: auto-detect visitor IP) - **baseCurrency** (string) - Optional - Base currency for exchange rates (default: USD) ### Request Example ```php '8.8.8.8', 'baseCurrency' => 'EUR', ]); // Alternative full namespace usage $geoip = new \Victorybiz\GeoIPLocation\GeoIPLocation([ 'ip' => null, 'baseCurrency' => 'USD', ]); ``` ``` -------------------------------- ### Laravel Facade Usage Source: https://context7.com/victorybiz/geoip-location/llms.txt Demonstrates how to use the GeoIPLocation Facade in Laravel applications (5.5+) for convenient static method access. ```APIDOC ## Laravel Facade Usage ### Description In Laravel applications (5.5+), use the GeoIPLocation Facade for convenient static method access. The package auto-registers via Laravel's package discovery. ### Usage Example ```php json([ 'ip' => $ip, 'country' => $country, 'country_code' => $countryCode, 'city' => $city, 'location' => $location, ]); ``` ### Manual Registration (Laravel < 5.5) For Laravel versions prior to 5.5, you need to manually register the service provider and facade alias in your `config/app.php` file: ```php // config/app.php 'providers' => [ // ... other service providers Victorybiz\GeoIPLocation\GeoIPLocationServiceProvider::class, ], 'aliases' => [ // ... other aliases 'GeoIPLocation' => Victorybiz\GeoIPLocation\Facades\GeoIPLocationFacade::class, ] ``` ``` -------------------------------- ### Instantiate GeoIPLocation Class Source: https://github.com/victorybiz/geoip-location/blob/master/README.md Instantiate the GeoIPLocation class. You can optionally set the IP address and base currency during instantiation. Localhost IPs will return a default valid geo response. ```php use Victorybiz\GeoIPLocation\GeoIPLocation; $geoip = new GeoIPLocation(); // OR $geoip = new GeoIPLocation([ 'ip' => null, // Set IP. Default is NULL, will be auto set by the package 'baseCurrency' => 'USD', // Set base currency for exchange rate. Default is USD ]); ``` ```php $geoip = new \Victorybiz\GeoIPLocation\GeoIPLocation(); // OR $geoip = new \Victorybiz\GeoIPLocation\GeoIPLocation([ 'ip' => null, // Set IP. Default is NULL, will be auto set by the package 'baseCurrency' => 'USD', // Set base currency for exchange rate. Default is USD ]); ``` -------------------------------- ### Retrieve Currency Information in PHP Source: https://context7.com/victorybiz/geoip-location/llms.txt Fetches the local currency code and symbol for the IP address location. ```php setIP('169.159.76.74'); $currencyCode = $geoip->getCurrencyCode(); $currencySymbol = $geoip->getCurrencySymbol(); echo "Currency Code: " . $currencyCode; // Output: "NGN" echo "Currency Symbol: " . $currencySymbol; // Output: "₦" // Display prices in local currency $priceUSD = 99.99; echo "Price: " . $currencySymbol . number_format($priceUSD, 2); ``` -------------------------------- ### Register Service Provider for Laravel < 5.5 Source: https://github.com/victorybiz/geoip-location/blob/master/README.md For Laravel versions older than 5.5, you need to manually register the service provider in your `config/app.php` file. ```php 'providers' => [ Victorybiz\GeoIPLocation\GeoIPLocationServiceProvider::class, ] ``` -------------------------------- ### Retrieve Country Information Source: https://context7.com/victorybiz/geoip-location/llms.txt Obtain the country name and ISO country code for localization purposes. ```php setIP('169.159.76.74'); $country = $geoip->getCountry(); $countryCode = $geoip->getCountryCode(); echo "Country: " . $country; // Output: "Nigeria" echo "Country Code: " . $countryCode; // Output: "NG" // Use for localization if ($countryCode === 'US') { echo "Welcome, American visitor!"; } ``` -------------------------------- ### Retrieve Formatted Location in PHP Source: https://context7.com/victorybiz/geoip-location/llms.txt Returns a string combining city, region, and country for display purposes. ```php setIP('169.159.76.74'); $location = $geoip->getLocation(); echo $location; // Output: " Lagos, Lagos, Nigeria" // Display visitor location echo "You are visiting from: " . trim($location); ``` -------------------------------- ### Retrieve Visitor IP Address Source: https://context7.com/victorybiz/geoip-location/llms.txt Fetch the current IP address, with automatic handling for proxies and Cloudflare headers. ```php getIP(); echo $ip; // Output: "203.0.113.45" // Note: Localhost IPs (127.0.0.1, ::1, 192.168.65.0, 172.18.0.1) // are automatically replaced with a test IP (169.159.82.111) ``` -------------------------------- ### setIP() - Set Specific IP Address Source: https://context7.com/victorybiz/geoip-location/llms.txt Allows you to manually set a specific IP address for which to perform the geolocation lookup. This is useful when you need to retrieve location data for an IP address that is not the current visitor's. ```APIDOC ## setIP() ### Description Sets a specific IP address for geolocation lookup. Useful when you need to look up location data for an IP other than the current visitor. ### Method `setIP(string $ip)` ### Parameters #### Path Parameters - **ip** (string) - Required - The IP address to set for lookup. ### Request Example ```php setIP('8.8.8.8'); // Now all subsequent calls will use this IP echo $geoip->getCountry(); // Output: "United States" echo $geoip->getCity(); // Output: "Mountain View" ``` ``` -------------------------------- ### Retrieve Region Information Source: https://context7.com/victorybiz/geoip-location/llms.txt Fetch the state or province name and its corresponding code. ```php setIP('169.159.76.74'); $region = $geoip->getRegion(); $regionCode = $geoip->getRegionCode(); echo "Region: " . $region; // Output: "Lagos" echo "Region Code: " . $regionCode; // Output: "Lagos" ``` -------------------------------- ### Set Custom IP for Lookup Source: https://context7.com/victorybiz/geoip-location/llms.txt Manually define an IP address to override the automatic detection for subsequent geolocation queries. ```php setIP('8.8.8.8'); // Now all subsequent calls will use this IP echo $geoip->getCountry(); // Output: "United States" echo $geoip->getCity(); // Output: "Mountain View" ``` -------------------------------- ### Retrieve Latitude and Longitude in PHP Source: https://context7.com/victorybiz/geoip-location/llms.txt Fetches geographic coordinates for a specific IP address. ```php setIP('169.159.76.74'); $latitude = $geoip->getLatitude(); $longitude = $geoip->getLongitude(); echo "Latitude: " . $latitude; // Output: "6.4541" echo "Longitude: " . $longitude; // Output: "3.3947" // Calculate distance or use with mapping APIs $coordinates = [ 'lat' => $latitude, 'lng' => $longitude ]; ``` -------------------------------- ### Retrieve Currency Exchange Rate in PHP Source: https://context7.com/victorybiz/geoip-location/llms.txt Calculates the exchange rate from a base currency to the visitor's local currency. ```php 'EUR' ]); $geoip->setIP('169.159.76.74'); $exchangeRate = $geoip->getCurrencyExchangeRate(); $currencyCode = $geoip->getCurrencyCode(); echo "Exchange Rate (EUR to $currencyCode): " . $exchangeRate; // Convert price to local currency $priceEUR = 50.00; $localPrice = $priceEUR * $exchangeRate; echo "Local price: " . number_format($localPrice, 2) . " " . $currencyCode; ``` -------------------------------- ### Register Facade Alias for Laravel < 5.5 Source: https://github.com/victorybiz/geoip-location/blob/master/README.md For Laravel versions older than 5.5, you also need to register the GeoIPLocation facade alias in your `config/app.php` file. ```php 'aliases' => [ 'GeoIPLocation' => Victorybiz\GeoIPLocation\Facades\GeoIPLocationFacade::class, ] ``` -------------------------------- ### GeoIP Location Class Methods Source: https://github.com/victorybiz/geoip-location/blob/master/README.md Methods available within the GeoIPLocation class to retrieve geographical and currency data for a given IP address. ```APIDOC ## GeoIPLocation Class Methods ### Description Methods to retrieve location and currency information based on an IP address. ### Methods - **getIP()**: Returns the client IP. - **setIP(string $ip)**: Sets an IP to get its geographical location. - **getCity()**: Returns the client IP City (null if none). - **getRegion()**: Returns the client IP Region (null if none). - **getRegionCode()**: Returns the client IP Region Code (null if none). - **getCountry()**: Returns the client IP Country. - **getCountryCode()**: Returns the client IP Country Code. - **getContinent()**: Returns the client IP Continent. - **getContinentCode()**: Returns the client IP Continent Code. - **getPostalCode()**: Returns the client IP Postal Code (null if none). - **getLatitude()**: Returns the client IP Latitude (null if none). - **getLongitude()**: Returns the client IP Longitude (null if none). - **getCurrencyCode()**: Returns the client IP Country Currency Code (null if none). - **getCurrencySymbol()**: Returns the client IP Country Currency Symbol (null if none). - **getCurrencyExchangeRate()**: Returns the client IP Country Currency Exchange Rate against NGN (null if none). - **getLocation()**: Returns the client IP Location string (city, region, country). ``` -------------------------------- ### Include Autoloader for Non-Laravel Projects Source: https://github.com/victorybiz/geoip-location/blob/master/README.md For PHP projects outside of Laravel, ensure you include the Composer autoloader file in your script to use the package. ```php require_once 'path/to/vendor/autoload.php'; ``` -------------------------------- ### Retrieve Postal Code in PHP Source: https://context7.com/victorybiz/geoip-location/llms.txt Returns the postal or zip code associated with the IP address location. ```php setIP('8.8.8.8'); $postalCode = $geoip->getPostalCode(); echo "Postal Code: " . $postalCode; // Output varies by location ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.