Download the PHP package voicetel/voiceml without Composer
On this page you can find all versions of the php package voicetel/voiceml. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download voicetel/voiceml
More information about voicetel/voiceml
Files in voicetel/voiceml
Package voiceml
Short Description Official PHP SDK for the VoiceML REST API (Twilio-compatible voice + AMD service from VoiceTel)
License MIT
Homepage https://voiceml.voicetel.com
Informations about the package voiceml
π VoiceML PHP SDK
The official PHP client for the VoiceML REST API β Twilio-compatible outbound voice and answering-machine-detection from VoiceTel, with modern PHP 8.1+ ergonomics and battle-tested Guzzle transport.
π Table of Contents
- Features
- Installation
- Quickstart
- Authentication
- Resource Reference
- Error Handling
- Pagination
- Migration from twilio-php
- Rate Limits
- Development
- API Documentation
- Contributors
- Sponsors
- License
β¨ Features
π‘οΈ Modern PHP, Strictly Typed
- PHP 8.1+ end-to-end β
readonlyproperties, named arguments, constructor property promotion,declare(strict_types=1)everywhere. - Typed request and response models for every one of the 81 API operations across 9 resource families β
Call->sid,Recording->duration,Queue->currentSizeall hint cleanly in your IDE. - Twilio-compatible wire shapes β
AccountSid,From,To, status callbacks, pagination envelopes β match what Twilio's Programmable Voice API documents. - PSR-4 autoloading under
VoiceML\β plays nicely with Symfony, Laravel, and every other Composer-aware framework.
π Production-Grade Transport
- Built on Guzzle 7 (
guzzlehttp/guzzle: ^7.8) β the de-facto HTTP client in the PHP ecosystem. - Automatic retry with exponential backoff on 429 / 5xx β honors
Retry-Afterheaders. - Configurable timeout per client (defaults to 30s) and configurable
maxRetries(defaults to 2). - HTTP Basic auth with
AccountSid:ApiKeyβ exactly what the Twilio SDK uses, so existing credentials work unchanged. - Structured exception hierarchy β
RateLimitException,AuthenticationException,NotFoundException, etc. all subclasses ofApiExceptionyou can catch broadly or narrowly.
π Complete API Coverage
- Calls β originate, fetch, terminate, update + per-call recordings, streams, siprec, transcriptions, notifications, events, and the
/Calls/{sid}/Paymentslifecycle (Pay TwiML companion). - Conferences β list, fetch, end conferences, plus participants (mute / hold / kick) and conference-scoped recordings.
- Queues β create, list, update, delete, peek, dequeue (front or specific member).
- Applications β CRUD on stored TwiML + callback bundles.
- Recordings β account-wide list, metadata fetch, audio fetch (follows S3 redirect), delete.
- Messages β create, fetch, list (To/From/DateSent filters + pagination), update (Body redaction; Status=canceled), delete.
- IncomingPhoneNumbers β list, fetch, update.
- Notifications β fetch, list.
- SIP β SIP Trunking: Domains (CRUD), CredentialLists + Credentials (CRUD), IpAccessControlLists + IpAddresses (CRUD), DomainβACL/CredentialList mappings (historical, Auth/Calls, Auth/Registrations namespaces).
- Routes V2 β Twilio Inbound Processing Region API:
$client->routesV2->sipDomains->fetch($name)/update($name, voiceRegion: 'us1', friendlyName: 'ingress'). - Diagnostics β
/healthdeep probe, OpenAPI spec.
π§ͺ Tested
- 110 unit tests with mocked Guzzle handlers β every method and every error path exercised, no network in CI.
- Conformance test suite that validates wire shapes against the published OpenAPI document β spec drift gets caught at parse time.
π¦ Clean Distribution
- Zero codegen footprint β every byte hand-written.
- Single Composer package, single namespace, no surprise transitive deps beyond Guzzle.
π Installation
Requires PHP 8.1 or later and the json extension (bundled with PHP).
π Quickstart
π Authentication
Every endpoint uses HTTP Basic with your AccountSid as the username and your per-tenant API key as the password β identical to Twilio's auth shape, so credentials issued for Twilio code work here unchanged.
For ports from the Twilio PHP SDK, the credential may be passed as authToken: instead of apiKey: β they are aliases:
Passing both raises ConfigurationException.
Don't have credentials yet? See voicetel.com/docs/api/v0.9/voiceml/ for issuance and rotation.
π Per-product hosts
VoiceML mirrors Twilio's product-per-subdomain model. Most resources answer on the default host (voiceml.voicetel.com), but two products ride their own subdomains, derived automatically from your baseUrl:
- Conversations (
$client->conversationsV1) βconversations.voicetel.com - Messaging Service (
$client->messagingV1) βmessaging.voicetel.com
Derivation swaps the voiceml label for a recognised *.voicetel.com host (e.g. east-1.us.voiceml.voicetel.com β east-1.us.messaging.voicetel.com); any other base URL (a self-hosted instance) keeps every product on that single host. Self-hosters can point a product at a custom host explicitly:
πΊοΈ Resource Reference
| Resource | Methods | Covers |
|---|---|---|
$client->calls |
originate, fetch, list, terminate, update | + per-call recordings, streams, siprec, transcriptions, notifications, events, payments |
$client->conferences |
list, fetch, end | participants (mute / hold / kick), conference-scoped recordings |
$client->queues |
create, list, update, delete | peek, dequeue (front or specific member) |
$client->applications |
CRUD on TwiML + callback bundles | |
$client->recordings |
account-wide list, metadata, audio fetch, delete | follows S3 redirect for audio |
$client->messages |
create, fetch, list, update, delete | To/From/DateSent filters; Body redaction; Status=canceled |
$client->incomingPhoneNumbers |
list, fetch, update | |
$client->notifications |
fetch, list | |
$client->conversationsV1 |
conversations, messages, participants, webhooks, roles, users, credentials, configuration, services | rides conversations.voicetel.com |
$client->messagingV1->services |
create, list, fetch, update, delete | Messaging Service (MGβ¦); rides messaging.voicetel.com |
$client->pricing |
v1/v2 voice, messaging, phoneNumbers, trunking β countries + numbers |
read-only pricing lookups |
$client->diagnostics |
/health, OpenAPI spec |
Every method that takes a request body accepts a typed model imported from VoiceML\Model:
Recording audio
The audio fetch follows VoiceML's single 302βS3 redirect transparently:
If the recording is gone (no local file and no S3 key), GoneException is raised.
π¨ Error Handling
All HTTP errors extend VoiceML\Exception\ApiException, which extends VoiceML\Exception\VoiceMLException (a RuntimeException). Catch broadly or narrowly:
| Status | Exception |
|---|---|
| 400 | VoiceML\Exception\BadRequestException |
| 401 | VoiceML\Exception\AuthenticationException |
| 403 | VoiceML\Exception\PermissionDeniedException |
| 404 | VoiceML\Exception\NotFoundException |
| 409 | VoiceML\Exception\ConflictException |
| 410 | VoiceML\Exception\GoneException |
| 429 | VoiceML\Exception\RateLimitException |
| 501 | VoiceML\Exception\NotImplementedApiException |
| 5xx | VoiceML\Exception\ServerException |
| other | VoiceML\Exception\ApiException |
The Twilio-compatible error body (code, message, more_info, status) is parsed into $e->errorCode, $e->getMessage(), $e->moreInfo (also $e->getMoreInfo()), and $e->body.
π Pagination
List operations return a β¦List model with a Twilio-compatible pagination envelope (page, pageSize, total, nextPageUri, previousPageUri, β¦). For /Calls and /Messages, use the iterate() generator helper to walk all pages transparently:
For other resources, page manually with $client-><resource>->list(new ListXParams(page: $n)) and walk nextPageUri until null.
π Migration from twilio-php
The accountSid + API token pair Twilio's SDK validates in its constructor works unchanged here:
Method names follow the resource map above ($client->calls->create(...), $client->queues->list(), β¦) rather than Twilio's $client->api->v2010->accounts($sid)->calls->create(...) chain β flatter, fewer keystrokes, same wire format on the way out. Request bodies are typed VoiceML\Model\β¦ objects instead of associative arrays, so your IDE catches typos before runtime.
β±οΈ Rate Limits
VoiceML applies per-tenant rate limits at the edge. The SDK automatically retries 429 responses with Retry-After honored, up to maxRetries (default 2). To bump it:
π οΈ Development
π API Documentation
- Reference docs: voicetel.com/docs/api/v0.9/voiceml/
- Validator: voicetel.com/voiceml/validator/
- SDK catalogue: voicetel.com/docs/voiceml-sdks/
- Type definitions: see the
VoiceML\Modelnamespace β every wire shape has a typed PHP class.
π Contributors
- Michael Mavroudis β Lead Developer
Contributions welcome. Open an issue describing the change you want to make, or send a pull request against main.
π Sponsors
| Sponsor | Contribution |
|---|---|
| VoiceTel Communications | Primary development and production hosting |
π License
MIT with the Commons Clause restriction. See voicetel.com/legal/.