Skip to content

Latest commit

 

History

History
44 lines (29 loc) · 1.02 KB

File metadata and controls

44 lines (29 loc) · 1.02 KB

PromptJuggler PHP SDK

The official PHP client for the PromptJuggler API. Run prompts and workflows, manage knowledge bases, and verify webhooks — fully typed, with flat, synchronous methods.

Requirements

  • PHP 8.2+

Installation

composer require promptjuggler/sdk

Usage

use PromptJuggler\Client\PromptJuggler;
use PromptJuggler\Client\Models\RunStatus;

$pj = new PromptJuggler('your-api-key');

// Trigger a run (async — returns the run ID)
$created = $pj->runPrompt('greeting', 'production', inputs: ['name' => 'Ada']);

// Poll for the result
$run = $pj->getPromptRun($created->getId());
if ($run->getStatus()?->is(RunStatus::COMPLETED)) {
    echo $run->getOutput();
}

Errors surface as PromptJuggler\Client\Exception\ApiException (with a statusCode). Verify incoming webhooks with PromptJuggler\Client\Webhook\WebhookSignature::isValid().

Documentation

Full guides and the API reference: https://docs.promptjuggler.com/sdks/php/overview

License

MIT