DEVELOPERS

Documentation

Integrate IP lookups and country controls into your application.

PHP SDK: install and call

PHP 8.1+ and cURL. Download the source, extract it, and require src/Client.php for the client alone. For PSR middleware, install dependencies from the included composer.json and configure autoloading.

Download source archive

<?php
require __DIR__ . '/origooo-sdk/src/Client.php';
$client = new \OrigoooSdk\Client(getenv('ORIGOOO_API_KEY'),
    'https://orig.ooo', timeoutMs: 2000, ttl: 300, retries: 1);
try {
    $location = $client->lookup('8.8.8.8');
    $country = $location['country_code'] ?? null;
} catch (\RuntimeException $error) {
    $status = $error->getCode();
    // Apply your unavailable-data fallback.
}

Adapt the require path to your actual extracted folder. lookup returns an array. Invalid input raises InvalidArgumentException; HTTP/transport failures raise RuntimeException with a status code where known.

Coverage, caching and failures

The source SDKs expose single-IP lookup and country-policy helpers. Use direct HTTP for batch, ASN, comparisons and metadata. A 404 becomes an empty country result. A 429 surfaces as an exception; handle it with bounded backoff in your application. Local SDK cache hits make no HTTP request. API-side cache hits remain billable.

Set the API origin explicitly to https://orig.ooo. Resolve a visitor IP using your configured trusted-proxy rules; a backend /v1/ip/me request identifies the backend server.

Apply a country policy

The following code belongs before protected content. It uses the actual client/policy interfaces in the downloadable SDK. The full guide includes installation assumptions, proxy handling and unknown-country behaviour.

<?php
require __DIR__ . '/origooo-sdk/src/Client.php';
require __DIR__ . '/origooo-sdk/src/Policy.php';
$client = new \OrigoooSdk\Client(getenv('ORIGOOO_API_KEY'), 'https://orig.ooo');
$policy = new \OrigoooSdk\Policy(blocked: ['US', 'GB'], unknown: 'deny');
$country = null;
try {
    // Configure trusted proxy CIDRs if your app is behind a proxy.
    $ip = \OrigoooSdk\Client::clientIP($_SERVER['REMOTE_ADDR'] ?? '',
        $_SERVER['HTTP_X_FORWARDED_FOR'] ?? '', []);
    $country = $client->lookup($ip)['country_code'] ?? null;
} catch (\Throwable $error) {
    // The policy's explicit unknown behaviour handles lookup failures.
}
if ($policy->decide($country) !== 'allow') {
    http_response_code(403);
    exit('This service is unavailable for this request.');
}
// Render your protected page only after the policy allows it.

Full php country-blocking guide →

YOUR NEXT BUILD STARTS HERE

Get your free API key.

1,000 monthly credits. No credit card required.

Account services are not connected in this preview. Explore the dashboard or download the implementation from your workspace.
Read the integration guide

Production accounts require verified email. Google OAuth and Paddle need deployment credentials.