PHP code example of stajor / yandex-translate

1. Go to this page and download the library: Download stajor/yandex-translate 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/ */

    

stajor / yandex-translate example snippets




$translateClient = new Yandex\Translate\TranslateClient('YANDEX-TARNSLATE-TOKEN');
$response = $translateClient->getLangs('en');



$translateClient = new Yandex\Translate\TranslateClient('YANDEX-TARNSLATE-TOKEN');
$response = $translateClient->detect('Hello world!');



$translateClient = new Yandex\Translate\TranslateClient('YANDEX-TARNSLATE-TOKEN');
$response = $translateClient->translate('Hello world!', 'ru');