PHP code example of phpesher / php-translator

1. Go to this page and download the library: Download phpesher/php-translator 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/ */

    

phpesher / php-translator example snippets




use PHPTranslator\src\Translator;

$translator = new Translator('YOU KEY');

try {
    echo $translator->translateText( 'ru', 'en', 'Яблоки у бабушки на даче были очень вкусные!' );
} catch ( \PHPTranslator\src\TranslatorException\TranslatorException $e ) {
    echo $e->getMessage();
}