| Package Data | |
|---|---|
| Maintainer Username: | bluora |
| Maintainer Contact: | dev@nkt.me (Nikita Gusakov) |
| Package Create Date: | 2016-07-21 |
| Package Last Update: | 2016-09-26 |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-11-07 15:00:44 |
| Package Statistics | |
|---|---|
| Total Downloads: | 23,689 |
| Monthly Downloads: | 116 |
| Daily Downloads: | 3 |
| Total Stars: | 9 |
| Total Watchers: | 1 |
| Total Forks: | 2 |
| Total Open Issues: | 0 |
Install using composer:
composer require bluora/laravel-yandex-translate ~1.0
In config/app.php:
Update the providers section with:
'providers' => [
...
Bluora\Yandex\Providers\YandexTranslateServiceProvider::class,
)
Update the aliases section with:
'aliases' => [
...
'YandexTranslate' => Bluora\Yandex\Facades\YandexTranslateFacade::class,
]
In config/services.php:
Add a new third party entry:
return [
...
'yandex-translate' => [
'key' => env('YANDEX_TRANSLATE_KEY', ''),
]
];
You can then add YANDEX_TRANSLATE_KEY=myapihere to your .env file.
echo YandexTranslate::translate('Hello world', 'en', 'ru');
echo YandexTranslate::translate('Hello world!', 'en', 'fr');
echo YandexTranslate::translate('Hello world!', false, 'fr');
echo YandexTranslate::translate('Hello world!', false, 'fr')->getOriginalLanguage();
print_r(YandexTranslate::translate(['Hello world!', 'I love you'], 'en', 'fr'));
print_r(YandexTranslate::translate([22 => 'Hello world!', 30 => 'I love you'], 'en', 'fr'));
print_r(YandexTranslate::translate(['first_word' => 'Hello world!', 'second_word' => 'I love you'], 'en', 'fr'));
Would output:
Привет мир
Bonjour tout le monde!
Bonjour tout le monde!
en
Array
(
[0] => Bonjour tout le monde!
[1] => Je vous aime
)
Array
(
[22] => Bonjour tout le monde!
[30] => Je vous aime
)
Array
(
['first_word'] => Bonjour tout le monde!
['second_word'] => Je vous aime
)
##Yandex API Key
You can get your API key here.