spiralink / vapi-php-sdk
An unofficial PHP SDK for accessing Vapi's API.
Installs: 14
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/spiralink/vapi-php-sdk
Requires
- php: ~8.4
- ext-json: *
- guzzlehttp/guzzle: ^7.4
Requires (Dev)
- laravel/pint: ^1.25.1
- phpstan/phpstan: ^1.12.32
- phpunit/phpunit: ^12.4.1
This package is auto-updated.
Last update: 2025-10-16 07:37:25 UTC
README
Vapi PHP SDK
This SDK provides convenient, fully-typed access to Vapi's API.
Installation
You can install the package via composer:
composer require spiralink/vapi-php-sdk
Usage
You can always refer to the documentation to examine the various resources that are available.
use Vapi\Vapi; $vapi = new Vapi(token: 'your-api-token'); $assistants = $vapi->assistants->list();
Handling exceptions
If something goes wrong during any kind of interaction, an exception of type VapiApiException will be thrown:
use Vapi\Exceptions\VapiApiException; try { $call = $vapi->calls->create($request); } catch (VapiApiException $ex) { $logger->log($ex->getMessage()); }
Retries
The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long as the request is deemed retriable and the number of retry attempts has not grown larger than the configured retry limit (default: 2).
A request is deemed retriable when any of the following HTTP status codes is returned:
Use the maxRetries request option to configure this behavior.
$call = $vapi->calls->create($request, [ 'maxRetries' => 0, // Override maxRetries at the request level ]);
Timeouts
The SDK defaults to a 30 second timeout. Use the timeout option to configure this behavior.
$call = $vapi->calls->create($request, [ 'timeout' => 15, // Override timeout at the request level ]);
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Security
If you discover any security related issues, please email support@spiralink.ai instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.