PHP code example of eleven-labs / api-service

1. Go to this page and download the library: Download eleven-labs/api-service library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

eleven-labs / api-service example snippets



$apiService = ElevenLabs\Api\Service\ApiServiceBuilder::create()->build('file:///absolute/path/to/your/schema.json');

$operationId = 'getSomething';
$parameters = ['foo' => 'bar'];

// A Synchronous Request

/** @var \ElevenLabs\Api\Service\Resource\Resource $resource */
$resource = $apiService->call($operationId, $parameters);

// An Asynchronous Request

$promise = $apiService->callAsync($operationId, $parameters);
/** @var \ElevenLabs\Api\Service\Resource\Resource $resource */
$resource = $promise->wait();