adachsoft / text-to-audio-contract
Vendor-agnostic PHP contract and DTOs for text-to-speech (TTS) providers.
Package info
gitlab.com/a.adach/text-to-audio-contract
pkg:composer/adachsoft/text-to-audio-contract
Requires
- php: ^8.3
Requires (Dev)
- adachsoft/php-code-style: ^0.4
- friendsofphp/php-cs-fixer: ^3.94
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^13.0
- rector/rector: ^2.3
This package is not auto-updated.
Last update: 2026-03-20 02:07:17 UTC
README
Shared contract library for text-to-speech (TTS) providers.
This package defines a minimal, vendor-agnostic PHP contract for converting text into audio, together with simple DTOs describing input and output payloads.
Installation
Require the package via Composer:
composer require adachsoft/text-to-audio-contract
Requirements
- PHP 8.3+
Provided API
Interface
AdachSoft\\TextToAudioContract\\Contract\\TextToSpeechInterface- single method:
synthesize(TextToSpeechRequestDto $request): TextToSpeechResponseDto- throws
TextToSpeechExceptionon provider errors or synthesis failures
- single method:
DTOs
AdachSoft\\TextToAudioContract\\Dto\\TextToSpeechRequestDto(final)- describes TTS input:
- text to be spoken (no instructions)
- logical voice identifier
- output format (
mp3,wav,opus) - optional language, speed, pitch, volume, style profile
- describes TTS input:
AdachSoft\\TextToAudioContract\\Dto\\TextToSpeechResponseDto(final)- describes TTS result:
- raw audio content (binary string)
- format
- optional duration (seconds) and sample rate
- describes TTS result:
Exception
AdachSoft\\TextToAudioContract\\Exception\\TextToSpeechException
Versioning
This library is versioned using Git tags. The initial stable contract is released as 0.1.0.
Backwards compatibility of the public contract (interface and DTO shapes) is treated as a priority.
Development
This project uses the shared code style and quality configuration from adachsoft/php-code-style:
- PHP-CS-Fixer configuration via
.php-cs-fixer.php - PHPStan configuration via
phpstan.neon - Rector configuration via
rector.php
Basic commands (recommended via composer.json scripts):
- Run tests:
vendor/bin/phpunit - Run static analysis:
composer stan - Check code style:
composer cs:check - Fix code style:
composer cs:fix - Run Rector:
composer rector