Official PHP SDK for Alecto Core

Maintainers

Package info

github.com/StrathWorks/AlectoCore-php

Homepage

pkg:composer/alectocore/sdk

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-03-22 16:29 UTC

This package is auto-updated.

Last update: 2026-04-22 16:41:15 UTC


README

Official PHP SDK for Alecto Core.

Requirements

  • PHP 8.0+
  • ext-curl
  • Alecto Core key

Install

composer require alectocore/sdk

Quickstart

<?php
use AlectoCore\AlectoCoreClient;

$client = new AlectoCoreClient("ak_live_xxx");
$out = $client->moderate(["text" => "you are an idiot"]);

echo $out["request_id"] . " " . $out["action"] . " " . $out["score"];

Supported methods

  • moderate(array $body): array
  • moderateHandle(array $body): array
  • moderateBatch(array $body): array
  • moderateStructured(array $body): array
  • categories(): array
  • feedback(array $body): array
  • queue(int $limit = 100): array
  • resolveQueueItem(string $requestId, array $body): array

Errors

Non-2xx responses throw AlectoCoreError with:

  • HTTP status
  • parsed response payload when available

Base URL override

$client = new AlectoCoreClient("ak_live_xxx", "http://localhost:8080");