PHP code example of chiarillomax / yandex-translator-bundle
1. Go to this page and download the library: Download chiarillomax/yandex-translator-bundle 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/ */
chiarillomax / yandex-translator-bundle example snippets
php
// app/AppKernel.php
public function registerBundles()
{
return array(
// ...
new \Yandex\TranslatorBundle\YandexTranslatorBundle()
);
}
php
//use Yandex\TranslatorBundle\Model\Key
$key = new Key();
$key->setValue('YourKey');
$request = $this->get('yandex.translator')->createRequest()
->setKey($key->getValue())
->setText('Hello Max')
->setFrom('en')
->setTo('it')
->send();
$text = $request->getText(); //Ciao Max