Download the PHP package atlasaidev/atlasvoice-sdk without Composer
On this page you can find all versions of the php package atlasaidev/atlasvoice-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download atlasaidev/atlasvoice-sdk
More information about atlasaidev/atlasvoice-sdk
Files in atlasaidev/atlasvoice-sdk
Package atlasvoice-sdk
Short Description PHP client for AtlasVoice Cloud text-to-speech: speech, audio jobs for long texts, voices, usage and licences. Works in WordPress, Laravel and plain PHP.
License MIT
Homepage https://atlasvoice.cloud
Informations about the package atlasvoice-sdk
AtlasVoice PHP SDK
The PHP client for AtlasVoice Cloud text-to-speech: turn text into natural speech, make whole articles into one MP3 in the background, list voices, and read your plan and usage.
- Works in plain PHP, Laravel, Symfony and WordPress. No framework is needed.
- PHP 7.4 or newer. The only requirement is the JSON extension; cURL is needed for the plain-PHP adapters.
- A failure is a
Resultwith a stable error code, never an exception. - Your key is sent only to the AtlasVoice service and is never logged, returned or put in an error.
Install
Quick start
Create a project in the AtlasVoice dashboard and copy its
secret key (av_live_…). Keep it on your server, for example in an environment variable.
'my-app/1.0' names your app in the service's logs, so support can find your calls.
Never put the secret key in a web page. For speech in visitors' browsers, use a publishable key (
av_pub_…) with the JavaScript SDK. This client refuses a publishable key.
Long texts: audio jobs
Send a whole article once (up to 200,000 characters). The service makes it in the background and joins it into one MP3, kept for 48 hours.
Ask again no sooner than the poll_after_ms the service returns. Check the file's bytes and
sha256 before you store it.
Natural voices (Premium): pass 'engine' => 'cloud' and a 'voice' id from
voices( $lang, 'cloud' ), with that voice's locale as the language ('en-US', not 'en').
Voices
Voices change rarely: keep the list for a while instead of asking on every page.
Other calls
| Method | What it does |
|---|---|
register( $platform, $site_url, $email, $name ) |
Asks for a project key (sent without a key) |
account() |
Plan, engines, allowance, limits, licence and links, in one call |
usage() |
This month's characters used and left |
attach_license( $key ) / detach_license() |
Connect or remove a Pro licence |
get_jobs( $ids ) / get_jobs_by_ref( $prefix ) / cancel_job( $id ) |
Manage jobs |
health() |
Service status, file hosts and job limits (no key) |
Results and errors
Every call returns a Result:
ok(): the call succeeded.data: the decoded answer (or MP3 bytes for audio).code(): a stable error code such asinvalid_api_key,quota_exceededorrate_limited.is_temporary()andretry_after(): whether to try again and when.request_id: follow one call through both sides' logs.
The full list of codes is in Error_Codes and the
API documentation.
In a framework
Plain_Php::client() keeps the circuit breaker's state in memory. In a web app, pass a store
backed by your cache, so one request learns that the service is down for the next:
Implement Contracts\State_Store (get, set, delete) and, if you want logs, Contracts\Logger.
For full control, build Client yourself with your own Contracts\Http_Transport.
WordPress
The AtlasVoice WordPress plugin bundles this client in libs/AtlasVoice/Sdk and uses the
WordPress HTTP API. To update it from this package:
src/Adapters is never copied: the WordPress plugin directory does not allow direct cURL calls.
Development
License
MIT. See LICENSE. The AtlasVoice WordPress plugin bundles this client under its own GPL licence; MIT is compatible with that.
All versions of atlasvoice-sdk with dependencies
ext-json Version *