定制 caraxes/speech-texter 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

caraxes/speech-texter

Composer 安装命令:

composer require caraxes/speech-texter

包简介

A Laravel package for speech-to-text processing.

README 文档

README

SpeechTexter is a Laravel package that simplifies speech-to-text processing by integrating with external services. This package provides an easy way to store, manage, and retrieve transcribed audio files while allowing full flexibility in configuring dependencies such as user and file models.

🚀 Features

  • Seamless speech-to-text integration
  • Configurable API endpoints
  • Dynamic model binding for User and File
  • Supports Laravel migrations and service providers
  • Queued job processing for speech recognition requests
  • Storage support for temporary and persistent audio files
  • Validation for user inputs and API requests

📞 External Service

This package integrates with the ussistant speech recognition service for Persian language support. If you intend to use this package for Persian speech-to-text conversion, please refer to the API documentation and services provided by ussistant.

📦 Installation

You can install this package via Composer:

composer require caraxes/speech-texter

After installation, publish the package configuration:

php artisan vendor:publish --tag=speech-texter-config

Example config/speech-texter.php:

return [
    'api_key' => env('SPEECH_TEXTER_X_API_KEY'),
    'voice_api' => env('SPEECH_TEXTER_VOICE_API'),
    'prefix' => 'speech-texter',
    'user_model' => env('SPEECH_TEXTER_USER_MODEL', 'App\Models\User'),
    'file_model' => env('SPEECH_TEXTER_FILE_MODEL', 'App\Models\File'),
];

🔧 Usage

1️⃣ Storing a Speech-to-Text Request

To store a new request, simply create a new SpeechTexter model instance:

use SpeechTexter\Models\SpeechTexter;

$record = SpeechTexter::create([
    'user_id' => auth()->id(),
    'file_id' => $fileId,
    'file_url' => $fileUrl,
    'file' => $fileData,
    'result' => json_encode($transcriptionResult),
    'response_status_code' => 200,
]);

2️⃣ Retrieving Speech-to-Text Results

To get the transcribed result of a specific file:

$record = SpeechTexter::find($id);
echo $record->result;

3️⃣ Handling Speech-to-Text Requests in the Repository

use SpeechTexter\Repositories\SpeechTexterRepository;

$speechTexterRepo = new SpeechTexterRepository();
$response = $speechTexterRepo->speechToText($userId, $fileId, [
    'file' => $uploadedFile,
]);

4️⃣ Accessing Related Models

$user = $record->user;
$file = $record->file;

5️⃣ Validating Inputs

use SpeechTexter\Validators\SpeechTexterValidator;

$validator = new SpeechTexterValidator();
$validator->validate($data);

⚙️ Service Provider

Make sure Laravel detects the service provider automatically:

'providers' => [
    SpeechTexter\Providers\SpeechTexterServiceProvider::class,
],

🏗 Running Migrations

php artisan migrate

🏗 Queue Processing

To handle speech recognition requests asynchronously:

php artisan queue:work

🔍 Continuous Integration (CI) Tests

This package is tested automatically using GitHub Actions with the following checks:

  • Code Quality: Static analysis with PHPStan (level=2) to ensure code correctness.
  • Dependency Management: Ensures all dependencies are installed and autoloaded correctly.
  • Laravel Optimization: Caches configurations and optimizes performance.
  • Database Migrations: Runs migrations to verify schema integrity.
  • Queue Handling: Configures queue driver for synchronous execution.

These tests ensure the package remains stable and functional in Laravel 11 environments.

🔒 Security

  • Do not expose your API key in the frontend.
  • Use environment variables for API keys and secrets.
  • Ensure your file uploads are properly sanitized to prevent security risks.

📝 License

This package is open-source and licensed under the MIT License.

🤝 Contributing

We welcome contributions! Feel free to submit pull requests and report issues in the GitHub repository.

📞 Support

For support, please open an issue on GitHub or contact me personally via email at amirmahdifor@gmail.com.

caraxes/speech-texter 适用场景与选型建议

caraxes/speech-texter 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 16 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 02 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 caraxes/speech-texter 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 caraxes/speech-texter 我们能提供哪些服务?
定制开发 / 二次开发

基于 caraxes/speech-texter 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 16
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 15
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-02-26