littlefish/uberduck

Uberduck's Rest API for PHP

0.0.9 2024-03-01 14:37 UTC

This package is auto-updated.

Last update: 2024-04-04 04:25:43 UTC


README

Latest Version Total downloads

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);