Search by

deferdie / acumen-ai-php

deferdie

PHP SDK for Acumen AI Security Monitoring — capture LLM traffic, redact PII, and stream events securely.

Package info

github.com/deferdie/acumen-ai-php

Homepage

pkg:composer/deferdie/acumen-ai-php

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-master 2026-10-05 18:13 UTC

This package is auto-updated.

Last update: 2026-10-05 18:20:28 UTC


README

Capture LLM traffic from PHP apps and send it to Acumen AI Security Monitoring.

Install

composer require deferdie/acumen-ai-php

Laravel

Publish config (optional):

php artisan vendor:publish --tag=acumen-ai-config

Set env:

ACUMEN_AI_ENDPOINT=https://app.acumenlogs.com/api/ai
ACUMEN_AI_KEY_ID=aik_...
ACUMEN_AI_SECRET=aisk_...

Usage

use AcumenAi\AcumenAi;

AcumenAi::withUser($userId)->withSession($sessionId);

$client = AcumenAi::wrapOpenAi(OpenAI::client(env('OPENAI_API_KEY')));
$response = $client->chat()->create([
    'model' => 'gpt-4o-mini',
    'messages' => [
        ['role' => 'user', 'content' => 'Hello'],
    ],
]);

// Optional sync guard (layers 1-3 only, fails open)
$decision = AcumenAi::instance()->guard([
    ['role' => 'user', 'content' => $userMessage],
]);
if ($decision['verdict'] === 'block') {
    abort(403);
}

Anthropic:

$client = AcumenAi::wrapAnthropic($anthropicClient);

Events flush automatically on Laravel request termination, or call AcumenAi::instance()->flush().

PII (emails, phones, cards, API keys) is redacted client-side before leaving your server.