PHP SDK
Official PHP client for the ResponsiveVoice Text-to-Speech API. Source: sdk-php.
Installation
Section titled “Installation”composer require responsivevoice/sdkQuick Start
Section titled “Quick Start”<?phprequire 'vendor/autoload.php';
use GuzzleHttp\Client;use ResponsiveVoice\Sdk\Api\SynthesisApi;use ResponsiveVoice\Sdk\Api\VoicesApi;use ResponsiveVoice\Sdk\Configuration;
$config = (new Configuration()) ->setApiKey('X-API-Key', getenv('RESPONSIVEVOICE_API_KEY')) ->setApiKey('X-API-Secret', getenv('RESPONSIVEVOICE_API_SECRET'));
// Synthesize speech — returns raw MP3 bytes.$audio = (new SynthesisApi(new Client(), $config)) ->v2TextSynthesizeGet('Hello world', 'UK English Female');file_put_contents('hello.mp3', $audio);
// List voices, optionally filtered by language.$voices = (new VoicesApi(new Client(), $config))->v2VoicesGet()->getVoices();Authentication
Section titled “Authentication”Server-side callers send an API key + secret pair as X-API-Key + X-API-Secret headers. Get both from your website's settings in the ResponsiveVoice dashboard (sign up): the API key from the "Your site code" snippet, and the API secret under "Server-to-server API secrets" (shown only once, revocable). PHP runs server-side, which is exactly where the secret belongs — browser apps use @responsivevoice/core, which authenticates by origin and needs no secret.
Reference Documentation
Section titled “Reference Documentation”- Package README on GitHub — full walkthrough, error handling, and the voice/synthesis surface
- Runnable examples — standalone PHP and a Laravel integration
- REST API reference — the underlying HTTP endpoints, for any language