Official PHP client SDK for building applications on Rapida APIs. This package is focused on client API operations (unary RPC-style calls).
composer require rapidaai/php- PHP
^8.1 - PHP extensions:
grpc,protobuf,json
<?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);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);$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();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);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);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
}- Included: client API calls for assistant/auth/endpoint/invoke/knowledge/project/etc.
- Excluded: agent stream and WebRTC realtime streaming runtime in this package.
- Proto request/response classes are already included in this SDK package.
- No manual proto generation step is required to use the SDK.