PHP code example of gabrielesbaiz / google-translate-toolkit

1. Go to this page and download the library: Download gabrielesbaiz/google-translate-toolkit 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/ */

    

gabrielesbaiz / google-translate-toolkit example snippets


return [
    /*
     * The ISO 639-1 code of the default source language.
     */
    'default_source_translation' => 'en',

    /*
     * The ISO 639-1 code of the language in lowercase to which
     * the text will be translated to by default.
     */
    'default_target_translation' => 'en',

    /*
     * Api Key generated within Google Cloud Dashboard.
     */
    'api_key' => env('GOOGLE_TRANSLATE_API_KEY'),
];

$googleTranslateToolkit = new Gabrielesbaiz\GoogleTranslateToolkit();

echo $googleTranslateToolkit->translate('Hello world');

use GoogleTranslateToolkit;

GoogleTranslateToolkit::translate('Hello world');
bash
php artisan vendor:publish --tag="google-translate-toolkit-config"