Luminova Framework

PHP Luminova: IP Address Info Provider Configuration

Last updated: 2026-11-28 20:57:12

Configure IP information lookups, caching, and trusted proxies.

The IP Configuration class allows developers to configure settings related to IP address lookup in their applications. It provides properties to specify the IP address API provider for IP info lookup, the API key, and caching of lookup results.


Class Definition

  • Full namespace: App\Config\IPConfig
  • File path: /app/Config/IPConfig.php
  • This configuration derives from Luminova\Base\AbstractConfig.
  • This class is final.

Properties

apiProvider

Specify the IP address API provider to use when looking up user IP address information.Available Providers: ipapi and iphub

  • ipapi: Provides IP geolocation and network information.
  • iphub: Provides IP intelligence, including VPN, proxy, and hosting detection.
public string $apiProvider = 'iphub';

If the value is not one of the supported providers, IP::info() returns an error result with status 700.


ipHubVersion

The API version used by IPHub. This only applies when $apiProvider is set to iphub.

public string $ipHubVersion = 'v2';

apiKey

Specify the API key for the configured IP address provider. Obtain the key from the provider's dashboard.

public string $apiKey = '';

When empty, requests are sent without authentication. For ipapi the key is sent as the key query parameter, and for iphub it is sent in the X-Key request header.


cacheIpDetail

Determines whether successful IP lookup results should be cached. When enabled, results are saved to avoid repeated external API requests.

public bool $cacheIpDetail = true;

Cached results are stored in /writeable/caches/ip/ as ip_info_{ip}.json. Use IP::clearInfoCache() to delete cached details.


cacheExpiration

Defines how long cached IP information remains valid, in seconds.

  • 0: Cache indefinitely (never expires).
  • >0: Cache expires after the specified number of seconds.
public int $cacheExpiration = 604800;

The default is 7 days. Negative values are treated as 0.

Trusted Proxies

Configure trusted proxy IP addresses and CIDR subnets in Security configuration.

IP::isTrustedProxy() reads that setting and supports IPv4 and IPv6 addresses, including CIDR notation. If no trusted proxies are configured, it returns true.