adachsoft/text-to-audio-contract

Vendor-agnostic PHP contract and DTOs for text-to-speech (TTS) providers.

Maintainers

Package info

gitlab.com/a.adach/text-to-audio-contract

Issues

pkg:composer/adachsoft/text-to-audio-contract

Statistics

Installs: 2

Dependents: 1

Suggesters: 0

Stars: 0

0.1.0 2026-03-19 08:02 UTC

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 TextToSpeechException on provider errors or synthesis failures

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
  • AdachSoft\\TextToAudioContract\\Dto\\TextToSpeechResponseDto (final)
    • describes TTS result:
      • raw audio content (binary string)
      • format
      • optional duration (seconds) and sample rate

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