PHP code example of jayesh / laravel-gemini-translator

1. Go to this page and download the library: Download jayesh/laravel-gemini-translator 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/ */

    

jayesh / laravel-gemini-translator example snippets


'manager' => [
    'enabled' => true,
    'prefix' => 'translations-manager',
    'middleware' => ['web'],
],

// ✅ CORRECT
'request_timeout' => (int) env('GEMINI_REQUEST_TIMEOUT', 600),

// ❌ WRONG - Will cause "Configuration value must be an integer" error
'request_timeout' => env('GEMINI_REQUEST_TIMEOUT', 600),

// Add a new model, raise/lower a row, or retire one with 0/0
'gemini-4-flash-lite' => ['rpm' => 60, 'rpd' => 2000],
'gemini-2.5-flash' => ['rpm' => 0, 'rpd' => 0],

'request_timeout' => (int) env('GEMINI_REQUEST_TIMEOUT', 600),
bash
php artisan vendor:publish --tag=gemini-translator-manager
bash
php artisan vendor:publish --tag=gemini-translator-manager --force
php artisan view:clear

# Or delete published views (there is no artisan unpublish)
rm -rf resources/views/vendor/gemini-translator
php artisan view:clear

lang/
├── en/
│   ├── auth.php
│   ├── pagination.php
│   ├── passwords.php
│   └── validation.php
├── es/
│   ├── auth.php
│   ├── pagination.php
│   ├── passwords.php
│   └── validation.php
├── en.json
├── es.json
└── fr.json
bash
php artisan vendor:publish --tag=gemini-translator-config