PHP code example of avadim / yandex-cloud-translate-php
1. Go to this page and download the library: Download avadim/yandex-cloud-translate-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
avadim / yandex-cloud-translate-php example snippets
$ya = new avadim\YandexCloud\Auth\Auth($oAuthToken);
$tr = new \avadim\YandexCloud\Translator\Translator($ya, $folderId);
var_dump($tr->translate('<span>красная</span> корова', 'en', null, true));
var_dump($tr->getStats());
// 1st way
$ya = new avadim\YandexCloud\Auth\Auth(null);
$ya->setApiKey($apiKey);
$tr = new \avadim\YandexCloud\Translator\Translator($ya, $folderId);
// 2nd way
$ya = new avadim\YandexCloud\Auth\Auth(null);
$tr = new \avadim\YandexCloud\Translator\Translator($ya, $folderId);
$tr->useApiKey($apiKey);
var_dump($tr->translate('<span>красная</span> корова', 'en', null, true));
var_dump($tr->getStats());
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.