littlefish / uberduck
Uberduck's Rest API for PHP
Requires
- nyholm/psr7: ^1.8
- php-http/client-common: ^2.7
- php-http/discovery: ^1.19
- psr/http-client-implementation: *
Requires (Dev)
- guzzlehttp/guzzle: ^7.0
- illuminate/support: ^11.0
- orchestra/testbench: 9.x
- php-http/mock-client: 1.x
- phpunit/phpunit: 11.0.x
README
uberduck
Uberduck's Rest API for PHP. For the full document on Uberduck's API, please refer to the official document.
Documentation
Installation
To begin, you'll need to add the component to your composer.json
composer require littlefish/uberduck
After adding the component, update your packages using composer update
or install them using composer install
.
Environment variables
This library requires you to have following settings in your environment variables:
UBERDUCK_KEY=<your-uberduck-key> UBERDUCK_SECRET=<your-uberduck-secret-key> UBERDUCK_HOST=<uberduck-api-host> # optional
Laravel config (optional)
You can use this package with your Laravel project directly after installed. If you need to modify the default config, you can add a uberduck
config key:
'uberduck' => [ 'api_key' => 'your-uberduck-key', 'api_secret' => 'your-uberduck-secret-key', 'api_host' => 'uberduck-api-host' ]
Usage
The following API methods are mostly following the official Uberduck document. You can find more detailed usage by reading the document. For the payloads(parameters), please find detailed description in the official document.
List Voices
Get information on available voices.
Example:
$response = uberduck->listVoices($payload);
List Voice Samples
Return sample outputs from the specified VoiceModel.
Example:
$response = uberduck->listVoiceSamples($voiceModelUuid);
List Backing Tracks
List backing tracks.
Example:
$response = uberduck->listBackingTracks(); // or $response = uberduck->listBackingTracks($payload);
Generate Lyrics
Example:
$response = uberduck->generateLyrics($payload);
Generate Freestyle
Example:
$response = uberduck->generateFreestyle($payload);
Prompt Builder
Custom prompt can be created through the PROMPT BUILDER
tab in your Uberduck dashboard.
Example:
/* $payload should be the variables you want to POST to your prompt, not including the `variables` key. $payload = [ 'parameter' => 'value' ]; The function will stringify your $payload with following php object structure in the POST body: ['variables' => $payload] */ $response = uberduck->customPrompt($key, $payload);