Server endpoint natal-chart.php calls
$roxy->astrology->generateNatalChart(...) via the PHP SDK
and returns the JSON unchanged. The browser hands that JSON to
<roxy-natal-chart>, which renders the wheel.
<?php
require __DIR__ . '/../vendor/autoload.php';
use function RoxyAPI\Sdk\createRoxy;
use RoxyAPI\Sdk\RoxyApiException;
header('Content-Type: application/json');
$roxy = createRoxy(getenv('ROXY_API_KEY') ?: '');
try {
echo json_encode($roxy->astrology->generateNatalChart(
date: $_GET['date'],
time: $_GET['time'],
latitude: (float) $_GET['lat'],
longitude: (float) $_GET['lon'],
timezone: is_numeric($_GET['tz']) ? (float) $_GET['tz'] : $_GET['tz'],
));
} catch (RoxyApiException $e) {
http_response_code($e->statusCode);
echo json_encode(['error' => $e->error, 'code' => $e->errorCode]);
}