PHP code example of tinyapps / deepl-client
1. Go to this page and download the library: Download tinyapps/deepl-client 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/ */
tinyapps / deepl-client example snippets
use TinyApps\DeepL\Translator;
use TinyApps\DeepL\Options;
use TinyApps\DeepL\TargetLanguage;
$translator = new Translator('your_api_key');
$result = $translator->translate(
text: 'Hello World',
source: null, // let's DeepL auto-detect the source language
target: TargetLanguage::GERMAN,
preserveFormatting: false,
splitSentences: Options::SPLIT_SENTENCES_DEFAULT,
formality: Options::FORMALITY_DEFAULT,
);
$result->getText(); // translated text
$result->getDetectedSourceLanguage(); // EN