PHP SDK
PHP 8.1+ integration for Zeq OS. Use HulyaSync for local temporal synchronization; call the REST API for operator computation.
Installation
composer require zeq/zeq-os
Or use PHP's built-in curl — no Composer dependency needed for REST calls.
Authentication
<?php
$BASE = 'http://localhost';
function zeq_login(string $equation, string $base): string {
$ch = curl_init("$base/api/users/login");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode(['equation' => $equation]),
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_RETURNTRANSFER => true,
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
return $data['token'];
}
$token = zeq_login('x^2 + sin(y*pi) + phi', $BASE);
Quick Start
<?php
$BASE = 'http://localhost';
$TOKEN = 'your-jwt-token';
function zeq_get(string $url): array {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$body = curl_exec($ch);
curl_close($ch);
return json_decode($body, true);
}
function zeq_post(string $url, array $body, ?string $token = null): array {
$ch = curl_init($url);
$headers = ['Content-Type: application/json'];
if ($token) $headers[] = "Authorization: Bearer $token";
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($body),
CURLOPT_HTTPHEADER => $headers,
CURLOPT_RETURNTRANSFER => true,
]);
$body = curl_exec($ch);
curl_close($ch);
return json_decode($body, true);
}
// 1. Browse operators — public, no auth
$ops = zeq_get("$BASE/api/zeq/operators");
foreach (array_slice($ops['operators'], 0, 3) as $op) {
printf("%-6s %-30s %s\n", $op['id'], $op['name'], $op['equation']);
}
// 2. HulyaPulse phase — no auth
$phase = zeq_get("$BASE/api/zeq/phase");
printf("Phase: %.4f KO42: %.6f\n", $phase['phase'], $phase['ko42']);
// 3. Execute operator — requires account
$result = zeq_post(
"$BASE/api/zeq/operators/execute?operator=NM21",
['params' => ['G' => 6.674e-11, 'm1' => 5.97e24, 'm2' => 7.35e22, 'r' => 3.84e8]],
$TOKEN
);
echo "F = {$result['value']} N\n";
// 4. 7-Step Wizard — requires account
$state = zeq_post("$BASE/api/7step/run", [
'query' => 'gravitational time dilation near Earth',
'operators' => ['KO42', 'GR37'],
'mode' => 'basic',
], $TOKEN);
echo "Operators: " . implode(', ', $state['selected_operators']) . "\n";
echo "Master sum: {$state['master_sum']}\n";
HulyaSync (Local)
use ZeqOS\SDK\HulyaSync;
$sync = new HulyaSync();
// All local — no server, no auth
printf("Phase: %.4f\n", $sync->currentPhase());
printf("Zeqond: %d\n", $sync->getZeqond());
printf("KO42: %.6f\n", $sync->ko42Automatic());
// Zeq Equation: R(t) = S(t) × [1 + α·sin(2πft)]
printf("g mod: %.6f\n", $sync->modulate(9.80665));
echo $sync->daemonTick() . "\n";
Framework Equations
Zeq Equation: R(t) = S(t) × [1 + α × sin(2π × 1.287 × t)]
KO42: α × sin(2π × 1.287 × t)
HULYAS: □(φ) − μ ²(r)φ − λφ³ − exp(−φ/φ_c) + φ₄₂ × Σ(Cₖ(φ)) = T^μ_μ + βF·F + J_ext
REST API Reference
| Endpoint | Auth | Description |
|---|---|---|
POST /api/users/login | — | Login with equation |
GET /api/zeq/phase | — | HulyaPulse phase + KO42 |
GET /api/zeq/operators | — | All operators + equations (public) |
POST /api/zeq/operators/execute?operator=ID | Required | Execute operator |
POST /api/7step/run | Required | 7-Step Wizard |