libcast/authot-client
Composer 安装命令:
composer require libcast/authot-client
包简介
Authot Client
README 文档
README
This package wraps Auhtôt API into a PHP client. Oauth2 implementation is provided.
Installation
To install, use composer:
composer require libcast/authot-client
Usage
<?php
// Http client
$httpClient = new \GuzzleHttp\Client([
'base_uri' => 'https://app.xn--autht-9ta.com/'
]);
// Oauth2 provider
$provider = new \Libcast\OAuth2\Client\Provider\Authot([
'clientId' => '{authot-client-id}',
'clientSecret' => '{authot-client-secret}',
'redirectUri' => 'https://example.com/callback-url',
]);
// Create the client
$client = (new \Libcast\Authot\Oauth2\ClientFactory($httpClient, $provider))
->create('{access_token}');
// Submit a transcription
$transcription = $client->createWithCallback('/path/to/audio/file.mp3', 'fr', 'https://example.com/transcription-callback-url');
// Fetch a transcription by its ID
$transcription = $client->find(42647);
echo $transcription->getId();
echo $transcription->getLang();
echo $transcription->getProgress();
echo $transcription->getStatus();
echo $transcription->getTitle();
echo $transcription->isFinished();
// Get User time left
$userTimeLeft = $client->getUserTimeLeft();
echo $userTimeLeft->getTimeLeftCorrection()->format('H:i:s');
echo $userTimeLeft->getTimeLeftTranscription()->format('H:i:s');
// Export a subtitle
$subtitle = $client->export(42647, 'srt'); // Available formats: txt, xml, sjson, srt, webvtt
file_put_contents('/path/to/output/file.srt', $subtitle);
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 21
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-07-29