deferdie / acumen-ai-php
PHP SDK for Acumen AI Security Monitoring — capture LLM traffic, redact PII, and stream events securely.
dev-master
2026-10-05 18:13 UTC
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7.2
Requires (Dev)
- phpunit/phpunit: ^10.0|^11.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
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.