massimo-me / YandexTranslatorBundle

Use Yandex translator in your Symfony Project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

YandexTranslatorBundle

SensioLabsInsight Scrutinizer Code Quality Build Status

Use Yandex translator service in your Symfony Project

Installation

Install the bundle:

composer require chiarillomax/yandex-translator-bundle

Register the bundle in app/AppKernel.php:

<?php
// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new \Yandex\TranslatorBundle\YandexTranslatorBundle()
    );
}

Usage

//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

Test

phpunit

About

Use Yandex translator in your Symfony Project


Languages

Language:PHP 100.0%