PHP Classes

PHP Yandex Translate: Translate application texts using Yandex API

Recommend this page to a friend!
  Info   View files Documentation   View files View files (13)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 32 This week: 1All time: 10,989 This week: 571Up
Version License PHP version Categories
yandex-language-tran 1.0.0Freeware7Web services, Language, PHP 7
Description 

Author

This package can translate application texts using Yandex API.

It can take a given text string in one language and sends a HTTP request to the Yandex API so it can translate it to another given language that is supported by this API.

Picture of Decode Web
  Performance   Level  
Name: Decode Web <contact>
Classes: 1 package by
Country: India India
Age: 32
All time rank: 4508305 in India India
Week rank: 420 Up26 in India India Up

Recommendations

Recommendation for a PHP class to translate text
Translate a word taken from a form

Documentation

yandex-language-translate

Package to translate message into different languages.

SETUP

Install via composer

composer require decodewebin/yandex-language-translate

Get Yandex language translate FREE api key from here:

https://tech.yandex.com/translate/

Add variables in ENV file

YANDEX_TRANSLATE_ENDPOINT=https://translate.yandex.net/api/v1.5/tr.json

and

YANDEX_TRANSLATE_API_KEY=YOUR_API_KEY_HERE

Run Command

php artisan vendor:publish --tag=yandex_config

Run Database Migration Command

php artisan migrate and

Run Language Seeder Command

php artisan db:seed --class="Decodewebin\YandexTranslate\Database\Seeds\LanguageSeeder"

Testing on the fly

Open localhost:8000/translate

Testing in your application

You can use translation endpoint in your application too.

Go to web.php and add the following code

`Route::get('/test-translate',function (){

dd(\Decodewebin\YandexTranslate\Static_Functions\Yandex::translate('Hello World','en','pt'));

});`

or in your controller, add USE the package functions like it

`use Decodewebin\YandexTranslate\Static_Functions\Yandex; ` `class YourController extends Controller ` {

` public function your_function() `

`{`

` dd(Yandex::translate("Hello World","en","ru");) `

`}`

}

Format

Yandex::translate(STRING_TO_TRANSLATE ORIGINAL_LANGUAGE_CODE, LANGUAGE_CODE_TO_TRANSLATE_INTO)

This function returns a json object as follows

{

` "translated": "Olá Mundo", ` ` "source_language_code": "en" `

}

If you liked this package then do follow me on


  Files folder image Files  
File Role Description
Files folder imagesrc (3 files, 5 directories)
Accessible without login Plain text file CODE_OF_CONDUCT.md Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
Files folder imagedatabase (2 directories)
Files folder imageHttp (1 directory)
Files folder imageModels (1 file)
Files folder imageStatic_Functions (1 file)
Files folder imageviews (1 file)
  Accessible without login Plain text file routes.php Example Example script
  Plain text file YandexTranslateServiceProvider.php Class Class source
  Accessible without login Plain text file yandex_config.php Aux. Auxiliary script

  Files folder image Files  /  src  /  database  
File Role Description
Files folder imagemigrations (1 file)
Files folder imageseeds (1 file)

  Files folder image Files  /  src  /  database  /  migrations  
File Role Description
  Plain text file 2019_07_23_052548_...languages_table.php Class Class source

  Files folder image Files  /  src  /  database  /  seeds  
File Role Description
  Plain text file LanguageSeeder.php Class Class source

  Files folder image Files  /  src  /  Http  
File Role Description
Files folder imageControllers (1 file)

  Files folder image Files  /  src  /  Http  /  Controllers  
File Role Description
  Plain text file YandexTranslateController.php Class Class source

  Files folder image Files  /  src  /  Models  
File Role Description
  Plain text file LanguageTranslate.php Class Class source

  Files folder image Files  /  src  /  Static_Functions  
File Role Description
  Plain text file Yandex.php Class Class source

  Files folder image Files  /  src  /  views  
File Role Description
  Accessible without login Plain text file translate.blade.php Aux. Auxiliary script

 Version Control Unique User Downloads Download Rankings  
 100%
Total:32
This week:1
All time:10,989
This week:571Up
User Comments (2)