adachsoft/text-to-audio-contract
最新稳定版本:0.1.0
Composer 安装命令:
composer require adachsoft/text-to-audio-contract
包简介
Vendor-agnostic PHP contract and DTOs for text-to-speech (TTS) providers.
README 文档
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
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 6
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-19