Skip to content

Authentication

The Poli Page PHP SDK authenticates every request with a bearer token. The key prefix determines which environment the request hits.

Pass the key to the client factory:

$client = PoliPage::client($_ENV['POLI_PAGE_API_KEY']);

The SDK never reads $_ENV['POLI_PAGE_API_KEY'] implicitly. You always pass the key in.

To target the develop environment (or a self-hosted gateway), use the full constructor and pass baseUrl:

$client = new PoliPage(
apiKey: $_ENV['POLI_PAGE_API_KEY'],
baseUrl: 'https://api-develop.poli.page',
);
<?php
require __DIR__ . '/vendor/autoload.php';
use PoliPage\PoliPage;
$client = new PoliPage(
apiKey: $_ENV['POLI_PAGE_API_KEY'],
baseUrl: $_ENV['POLI_PAGE_BASE_URL'] ?? 'https://api.poli.page',
);