Official PHP SDK for Rapida platform clients (non-streaming)

Maintainers

Package info

github.com/rapidaai/rapida-php

pkg:composer/rapidaai/php

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-main 2026-04-24 07:40 UTC

This package is not auto-updated.

Last update: 2026-04-25 05:51:28 UTC


README

Official PHP client SDK for building applications on Rapida APIs. This package is focused on client API operations (unary RPC-style calls).

Installation

composer require rapidaai/php

Requirements

  • PHP ^8.1
  • PHP extensions: grpc, protobuf, json

Quick Start

<?php

require 'vendor/autoload.php';

use Assistant_api\GetAllAssistantRequest;
use Rapida\Config\ConnectionConfig;
use Rapida\Rapida;

$config = ConnectionConfig::default(
    ConnectionConfig::withSdk('YOUR_API_KEY', 'user-123')
);

$sdk = new Rapida($config);

$request = new GetAllAssistantRequest();
$response = $sdk->assistants()->getAll($request);

Authentication Modes

Use whichever matches your app:

use Rapida\Config\ConnectionConfig;

ConnectionConfig::withSdk($apiKey, $userId);
ConnectionConfig::withWebPlugin($apiKey, $userId);
ConnectionConfig::withPersonalToken($jwt, $authId, $projectId);
ConnectionConfig::withDebugger($jwt, $userId, $projectId);

Configure Endpoints

$config = ConnectionConfig::default(ConnectionConfig::withSdk('YOUR_API_KEY'))
    ->withCustomEndpoint(
        assistantEndpoint: 'https://assistant.example.com',
        webEndpoint: 'https://api.example.com',
        endpointEndpoint: 'https://endpoint.example.com'
    );

For local environments:

$config = ConnectionConfig::default(ConnectionConfig::withSdk('YOUR_API_KEY'))
    ->withLocal();

Common Client Usage

The facade exposes service clients:

  • $sdk->assistants()
  • $sdk->auth()
  • $sdk->endpoints()
  • $sdk->invoke()
  • $sdk->calls()
  • $sdk->talk()
  • $sdk->knowledge()
  • $sdk->projects()
  • $sdk->organizations()
  • $sdk->vault()
  • $sdk->connect()
  • $sdk->activity()
  • $sdk->documents()
  • $sdk->notifications()
  • $sdk->billing()
  • $sdk->telemetry()

Example patterns:

// Get assistant
// $assistant = $sdk->assistants()->get($getAssistantRequest);

// Invoke endpoint
// $result = $sdk->invoke()->invoke($invokeRequest);

// Create phone call
// $call = $sdk->calls()->createPhoneCall($createPhoneCallRequest);

Per-Call Auth Override

If needed, pass auth for a specific call:

use Rapida\Auth\AuthContext;

$overrideAuth = AuthContext::withSdk('OTHER_API_KEY', 'user-override');
// $response = $sdk->assistants()->getAll($request, $overrideAuth);

Error Handling

Client calls throw Rapida\\Exceptions\\ServiceException on gRPC non-OK status:

use Rapida\Exceptions\ServiceException;

try {
    // $sdk->assistants()->getAll($request);
} catch (ServiceException $e) {
    // Log / map to your app error handling
}

Scope

  • Included: client API calls for assistant/auth/endpoint/invoke/knowledge/project/etc.
  • Excluded: agent stream and WebRTC realtime streaming runtime in this package.

Note

  • Proto request/response classes are already included in this SDK package.
  • No manual proto generation step is required to use the SDK.