PHPackages                             subhashladumor1/laravel-translate - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. subhashladumor1/laravel-translate

ActiveLibrary[Localization &amp; i18n](/categories/localization)

subhashladumor1/laravel-translate
=================================

🌐 Professional multi-source translation package for Laravel 11+ with free APIs (LibreTranslate, Lingva, MyMemory), smart caching, batch translation, CLI tools, and analytics dashboard. Zero API costs!

1.0.3(4mo ago)520↓100%MITPHPPHP ^8.1|^8.2|^8.3

Since Oct 25Pushed 4mo agoCompare

[ Source](https://github.com/subhashladumor1/laravel-translate)[ Packagist](https://packagist.org/packages/subhashladumor1/laravel-translate)[ Docs](https://github.com/subhashladumor1/laravel-translate)[ RSS](/packages/subhashladumor1-laravel-translate/feed)WikiDiscussions main Synced today

READMEChangelog (4)Dependencies (10)Versions (6)Used By (0)

🌐 Laravel Translate
===================

[](#-laravel-translate)

### Professional Multi-Source Translation Package for Laravel 11+

[](#professional-multi-source-translation-package-for-laravel-11)

[![Latest Version](https://camo.githubusercontent.com/bab0eb77a78500793073c696af1756aa96b82783b97ad4e2ba3dbc09d2b2f2a6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f737562686173686c6164756d6f72312f6c61726176656c2d7472616e736c6174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/subhashladumor1/laravel-translate)[![Laravel Version](https://camo.githubusercontent.com/19d5bb0370853f3f5f64da8e47f7b2e14803b7fa5f7c8d04e347ac6849edb9ee/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31322e782d7265642e7376673f7374796c653d666c61742d737175617265)](https://laravel.com)[![License](https://camo.githubusercontent.com/1484668bece2fc67b5e16e71a1d03dc3f69a88d93ec325a870415eaa5d831c04/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f737562686173686c6164756d6f72312f6c61726176656c2d7472616e736c6174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/subhashladumor1/laravel-translate)[![PHP Version](https://camo.githubusercontent.com/efdcd5e06345d3fc7a5842798797c935cd67f473c20a0ba86d8c94934a31f00a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f737562686173686c6164756d6f72312f6c61726176656c2d7472616e736c6174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/subhashladumor1/laravel-translate)

**Transform your Laravel application into a multilingual powerhouse with zero API costs!**
Automatic fallback • Smart caching • Batch translation • Analytics dashboard • Offline support

[Installation](#-installation) • [Quick Start](#-quick-start) • [Features](#-features) • [Documentation](#-documentation) • [Support](#-support)

---

✨ Why Laravel Translate?
------------------------

[](#-why-laravel-translate)

🎯 **Zero API Costs** - Use completely free translation services (no API key needed!)
⚡ **Lightning Fast** - Smart caching reduces API calls by 90%+
🔄 **Bulletproof** - Automatic fallback across 5 translation services
🎨 **Developer Friendly** - Blade directives, helpers, facades, CLI
📊 **Production Ready** - Built-in analytics and performance monitoring
🌍 **Truly Multilingual** - Support 100+ languages out of the box
🔌 **Offline Capable** - Works without internet using Argos
🚀 **SaaS Ready** - Perfect for multi-tenant applications

---

🎁 Features
----------

[](#-features)

### 🔥 Core Features

[](#-core-features)

- ✅ **5 Free Translation APIs**
    - Lingva Translate (Default - No API Key)
    - Google Free (No API Key)
    - MyMemory (No API Key)
    - LibreTranslate (Free tier available)
    - Argos (Offline)
- ✅ **Auto Language Detection**
- ✅ **Intelligent Fallback Chain**
- ✅ **Batch Translation**
- ✅ **Smart Caching System**

### 🛠️ Developer Tools

[](#️-developer-tools)

- ✅ **5 Powerful CLI Commands**
- ✅ **Blade Directives**
- ✅ **Helper Functions**
- ✅ **Facade Support**
- ✅ **Auto-Locale Middleware**
- ✅ **Queue Integration**
- ✅ **Analytics Dashboard**
- ✅ **Translation Logging**
- ✅ **Service Testing Tool**

---

📦 Installation
--------------

[](#-installation)

### Step 1: Install via Composer

[](#step-1-install-via-composer)

```
composer require subhashladumor1/laravel-translate
```

### Step 2: Publish Configuration (Optional)

[](#step-2-publish-configuration-optional)

```
php artisan vendor:publish --tag=translate-config
```

### Step 3: Configure (Optional)

[](#step-3-configure-optional)

Add to your `.env` file:

```
# Default service (works without API key)
TRANSLATE_DEFAULT_SERVICE=lingva

# Enable caching for better performance
TRANSLATE_CACHE_ENABLED=true
TRANSLATE_CACHE_DRIVER=redis
TRANSLATE_CACHE_TTL=86400

# Optional: Enable LibreTranslate with API key
# Get free key at https://portal.libretranslate.com
TRANSLATE_LIBRE_ENABLED=false
TRANSLATE_LIBRE_API_KEY=your-api-key-here
```

**That's it!** 🎉 The package works out-of-the-box with 3 services (Lingva, Google, MyMemory) - no API key required!

---

🚀 Quick Start
-------------

[](#-quick-start)

### 💡 Translate in 3 Ways

[](#-translate-in-3-ways)

#### 1️⃣ **Using Helper Function**

[](#1️⃣-using-helper-function)

```
// Simple translation
echo translateText('Hello World', 'es');
// Output: Hola Mundo

// With auto-detection
echo translate('Bonjour', 'en');
// Output: Hello
```

#### 2️⃣ **Using Facade**

[](#2️⃣-using-facade)

```
use Subhashladumor1\Translate\Facades\Translate;

$translation = Translate::translate('Good morning', 'fr');
// Output: Bonjour
```

#### 3️⃣ **In Blade Templates**

[](#3️⃣-in-blade-templates)

```

@translate('Welcome to our site', 'es')

@translateStart('de')
    This entire block will be translated to German.
    Multiple sentences are supported!
@translateEnd

{{ translateText('Thank you', app()->getLocale()) }}
```

---

📖 Complete Documentation
------------------------

[](#-complete-documentation)

### 🎯 Basic Usage

[](#-basic-usage)

#### **Translate Text**

[](#translate-text)

```
// Basic translation
$spanish = Translate::translate('Hello', 'es');

// Specify source language
$french = Translate::translate('Hello', 'fr', 'en');

// Auto-detect source
$result = Translate::translate('Hola', 'en', 'auto');
```

#### **Detect Language**

[](#detect-language)

```
$lang = Translate::detectLanguage('Bonjour le monde');
// Returns: 'fr'

// In Blade
Language: @detectLang($userText)
```

#### **Batch Translation**

[](#batch-translation)

```
$texts = ['Hello', 'Goodbye', 'Thank you'];
$translations = Translate::translateBatch($texts, 'it');
// Returns: ['Ciao', 'Arrivederci', 'Grazie']

// Translate arrays
$data = [
    'title' => 'Welcome',
    'message' => 'Hello World',
    'items' => ['One', 'Two', 'Three']
];

$translated = app('translator')->translateArray($data, 'es');
```

---

### 🎨 Blade Directives

[](#-blade-directives)

#### **@translate Directive**

[](#translate-directive)

```

@translate('Hello', 'es')

@translate($product->name, $userLanguage)

    @translate('Home', app()->getLocale())
    @translate('About Us', app()->getLocale())
    @translate('Contact', app()->getLocale())

```

#### **Block Translation**

[](#block-translation)

```
@translateStart('fr')
    We offer the best services in the industry.
    Our team is dedicated to providing excellent customer support.
    Contact us today to learn more about our offerings!
@translateEnd
```

#### **Forms with Translation**

[](#forms-with-translation)

```

    @translate('Full Name', $locale)

    @translate('Email Address', $locale)

    @translate('Submit', $locale)

```

---

### 🔧 CLI Commands

[](#-cli-commands)

#### **1. Test Services**

[](#1-test-services)

```
# Test all translation services
php artisan translate:test

# Test specific service
php artisan translate:test --service=lingva

# Custom text and language
php artisan translate:test --text="Good morning" --target=fr
```

This command helps you:

- ✅ Verify which services are working
- ✅ Check API response times
- ✅ Diagnose connection issues
- ✅ See translation quality

#### **2. Translate String**

[](#2-translate-string)

```
# Basic usage
php artisan translate:string "Hello World" es
# Output: Hola Mundo

# Specify source language
php artisan translate:string "Bonjour" en --source=fr
# Output: Hello
```

#### **3. Translate Files**

[](#3-translate-files)

```
# Translate Laravel language file
php artisan translate:file resources/lang/en/messages.php es

# Custom output path
php artisan translate:file resources/lang/en/auth.php fr --output=lang/fr/auth.php

# Export as JSON
php artisan translate:file resources/lang/en/validation.php de --format=json
```

#### **4. Sync Translations**

[](#4-sync-translations)

```
# Sync to multiple languages
php artisan translate:sync --source=en --target=es,fr,de

# Force overwrite existing translations
php artisan translate:sync --source=en --target=es --force

# Custom language directory
php artisan translate:sync --source=en --target=fr --path=lang
```

#### **5. Clear Cache**

[](#5-clear-cache)

```
# Clear translation cache
php artisan translate:clear-cache

# Also clear analytics
php artisan translate:clear-cache --analytics
```

---

### 🎯 Advanced Features

[](#-advanced-features)

#### **Middleware - Auto Locale Detection**

[](#middleware---auto-locale-detection)

Register the middleware in your Laravel app:

```
// In bootstrap/app.php (Laravel 11)
->withMiddleware(function (Middleware $middleware) {
    $middleware->alias([
        'detect.locale' => \Subhashladumor1\Translate\Http\Middleware\DetectLocale::class,
    ]);
})
```

Apply to routes:

```
Route::middleware(['detect.locale'])->group(function () {
    Route::get('/', [HomeController::class, 'index']);
    Route::get('/products', [ProductController::class, 'index']);
});
```

**The middleware automatically detects locale from:**

1. URL query parameter (`?lang=es`)
2. User session
3. Authenticated user's language preference
4. Browser Accept-Language header
5. GeoIP (optional)

#### **Queue Integration**

[](#queue-integration)

For large translation jobs:

```
use Illuminate\Support\Facades\Queue;

Queue::push(function() {
    $products = Product::all();

    foreach ($products as $product) {
        $translations = Translate::translateBatch([
            $product->name,
            $product->description
        ], 'es');

        // Save translations...
    }
});
```

Configure queue settings in `config/translate.php`:

```
'queue' => [
    'enabled' => true,
    'connection' => 'redis',
    'queue' => 'translations',
],
```

---

### 📊 Analytics Dashboard

[](#-analytics-dashboard)

Access the beautiful analytics dashboard:

```
http://your-app.test/translate/dashboard

```

**Monitor:**

- 📈 Cache hit/miss rates
- ⚡ API latency per service
- 📝 Recent translation logs
- 🎯 Service performance comparison
- 💾 Storage efficiency

**Protect the dashboard** (recommended):

```
// In routes/web.php or RouteServiceProvider
Route::middleware(['web', 'auth', 'can:view-analytics'])->group(function () {
    Route::get('/translate/dashboard', [\Subhashladumor1\Translate\Http\Controllers\DashboardController::class, 'index']);
});
```

---

### ⚙️ Configuration

[](#️-configuration)

#### **Service Configuration**

[](#service-configuration)

Edit `config/translate.php`:

```
return [
    // Default translation service (no API key required)
    'default_service' => env('TRANSLATE_DEFAULT_SERVICE', 'lingva'),

    // Fallback chain - tries services in order
    // Services without API key requirements are prioritized
    'fallback_chain' => ['lingva', 'google', 'mymemory', 'libre'],

    // Default languages
    'source_lang' => env('TRANSLATE_SOURCE_LANG', 'auto'),
    'target_lang' => env('TRANSLATE_TARGET_LANG', 'en'),
    'fallback_lang' => env('TRANSLATE_FALLBACK_LANG', 'en'),

    // Cache configuration
    'cache' => [
        'enabled' => env('TRANSLATE_CACHE_ENABLED', true),
        'driver' => env('TRANSLATE_CACHE_DRIVER', 'file'), // file, redis, database
        'ttl' => env('TRANSLATE_CACHE_TTL', 86400), // 24 hours
        'prefix' => 'translate',
        'auto_invalidate' => true,
    ],

    // Service endpoints
    'services' => [
        'libre' => [
            'enabled' => env('TRANSLATE_LIBRE_ENABLED', false), // Requires API key
            'endpoint' => 'https://libretranslate.com',
            'api_key' => env('TRANSLATE_LIBRE_API_KEY', null), // Get free key at https://portal.libretranslate.com
            'timeout' => 15,
        ],
        'lingva' => [
            'enabled' => env('TRANSLATE_LINGVA_ENABLED', true), // No API key needed
            'endpoint' => 'https://lingva.ml',
            'timeout' => 15,
        ],
        'google' => [
            'enabled' => env('TRANSLATE_GOOGLE_ENABLED', true), // No API key needed
            'endpoint' => 'https://translate.googleapis.com',
            'timeout' => 15,
        ],
        'mymemory' => [
            'enabled' => env('TRANSLATE_MYMEMORY_ENABLED', true), // No API key needed
            'endpoint' => 'https://api.mymemory.translated.net',
            'email' => env('TRANSLATE_MYMEMORY_EMAIL', null), // Optional for higher limits
            'timeout' => 15,
        ],
        // ... more services
    ],

    // Analytics
    'analytics' => [
        'enabled' => env('TRANSLATE_ANALYTICS_ENABLED', true),
        'track_cache_hits' => true,
        'track_api_latency' => true,
        'log_translations' => env('TRANSLATE_LOG_TRANSLATIONS', false),
        'retention_days' => 30,
    ],
];
```

#### **Cache Drivers**

[](#cache-drivers)

**For Production (Redis - Recommended):**

```
TRANSLATE_CACHE_DRIVER=redis
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
```

**For Development (File):**

```
TRANSLATE_CACHE_DRIVER=file
```

**For Database:**

```
php artisan cache:table
php artisan migrate
```

```
TRANSLATE_CACHE_DRIVER=database
```

---

### 🌍 Supported Translation Services

[](#-supported-translation-services)

ServiceSpeedQualityAPI KeyOfflineRate LimitStatus🟢 **Lingva**⚡⚡⚡⚡⭐⭐⭐⭐❌ No❌Generous✅ Default🟢 **Google Free**⚡⚡⚡⚡⚡⭐⭐⭐⭐⭐❌ No❌Good✅ Active🟡 **MyMemory**⚡⚡⭐⭐⭐❌ No❌1000/day✅ Active🟡 **LibreTranslate**⚡⚡⚡⭐⭐⭐⭐⚠️ Required❌100K/mo free⚙️ Optional🟢 **Argos**⚡⚡⚡⭐⭐⭐❌ No✅Unlimited⚙️ Optional**Legend:** ⚡ = Fast | ⭐ = Quality Rating

**Important Notes:**

- **Lingva, Google, MyMemory**: Work out-of-the-box, no API key required
- **LibreTranslate**: Now requires free API key from [portal.libretranslate.com](https://portal.libretranslate.com)
- **Argos**: Self-hosted, offline translation (requires installation)

---

### 🔑 LibreTranslate API Key Setup (Optional)

[](#-libretranslate-api-key-setup-optional)

LibreTranslate now requires an API key. Get one for **FREE** (100,000 characters/month):

**Step 1: Get Free API Key**

1. Visit
2. Sign up (no credit card required)
3. Get your API key from dashboard

**Step 2: Configure Laravel**

Add to `.env`:

```
TRANSLATE_LIBRE_ENABLED=true
TRANSLATE_LIBRE_API_KEY=your-api-key-here
```

**Step 3: Test**

```
php artisan translate:test --service=libre
```

**Alternative: Self-Host LibreTranslate**

```
# Run locally with Docker (no API key needed)
docker run -d -p 5000:5000 libretranslate/libretranslate
```

Then configure:

```
TRANSLATE_LIBRE_ENABLED=true
TRANSLATE_LIBRE_ENDPOINT=http://localhost:5000
# No API key needed for self-hosted
```

---

### 🔌 Offline Translation (Argos)

[](#-offline-translation-argos)

**Setup Argos Translate for offline use:**

1. Install Argos:

```
pip install argostranslate
```

2. Run Argos server:

```
argos-translate --host 0.0.0.0 --port 5000
```

3. Enable in config:

```
'services' => [
    'argos' => [
        'enabled' => true,
        'endpoint' => 'http://localhost:5000',
    ],
],
```

Perfect for:

- Air-gapped environments
- Privacy-sensitive applications
- No internet dependency
- Unlimited translations

---

💼 Real-World Examples
---------------------

[](#-real-world-examples)

### **E-commerce Product Translation**

[](#e-commerce-product-translation)

```
namespace App\Http\Controllers;

use App\Models\Product;
use Subhashladumor1\Translate\Facades\Translate;

class ProductController extends Controller
{
    public function translateProducts()
    {
        $products = Product::all();
        $targetLanguages = ['es', 'fr', 'de', 'it'];

        foreach ($products as $product) {
            foreach ($targetLanguages as $lang) {
                ProductTranslation::updateOrCreate([
                    'product_id' => $product->id,
                    'language' => $lang,
                ], [
                    'name' => translateText($product->name, $lang),
                    'description' => translateText($product->description, $lang),
                    'features' => translate_array($product->features, $lang),
                ]);
            }
        }

        return response()->json(['message' => 'Products translated!']);
    }
}
```

### **Multi-Language Blog**

[](#multi-language-blog)

```

    {{ translateText($post->title, app()->getLocale()) }}

        {{ translateText('Published on', app()->getLocale()) }}: {{ $post->published_at }}
        {{ translateText('By', app()->getLocale()) }} {{ $post->author }}

        @translateStart(app()->getLocale())
            {!! $post->content !!}
        @translateEnd

        {{ translateText('Tags', app()->getLocale()) }}:
        @foreach($post->tags as $tag)
            {{ translateText($tag, app()->getLocale()) }}
        @endforeach

```

### **Dynamic Contact Form**

[](#dynamic-contact-form)

```
public function sendContactForm(Request $request)
{
    $userLang = $request->user()->preferred_language ?? 'en';

    // Send confirmation in user's language
    $confirmationMessage = translateText(
        'Thank you for contacting us! We will respond within 24 hours.',
        $userLang
    );

    // Send notification to admin in default language
    $adminNotification = translateText(
        'New contact form submission from {name}',
        config('app.locale')
    );

    return response()->json([
        'message' => $confirmationMessage
    ]);
}
```

### **Automated Language File Sync**

[](#automated-language-file-sync)

```
// app/Console/Kernel.php
protected function schedule(Schedule $schedule)
{
    // Auto-sync translations daily at 2 AM
    $schedule->command('translate:sync --source=en --target=es,fr,de')
             ->dailyAt('02:00')
             ->emailOutputOnFailure('admin@example.com');

    // Clear old cache weekly
    $schedule->command('translate:clear-cache')
             ->weekly()
             ->sundays()
             ->at('03:00');
}
```

---

🎓 API Reference
---------------

[](#-api-reference)

### **Facade Methods**

[](#facade-methods)

#### `Translate::translate()`

[](#translatetranslate)

```
Translate::translate(string $text, ?string $targetLang = null, string $sourceLang = 'auto'): string
```

Translates text to the target language.

#### `Translate::translateBatch()`

[](#translatetranslatebatch)

```
Translate::translateBatch(array $texts, ?string $targetLang = null, string $sourceLang = 'auto'): array
```

Translates multiple texts at once.

#### `Translate::detectLanguage()`

[](#translatedetectlanguage)

```
Translate::detectLanguage(string $text): string
```

Detects the language of given text.

#### `Translate::clearCache()`

[](#translateclearcache)

```
Translate::clearCache(): void
```

Clears all translation cache.

#### `Translate::getAnalytics()`

[](#translategetanalytics)

```
Translate::getAnalytics(): array
```

Returns analytics data including cache stats and latency.

---

### **Helper Functions**

[](#helper-functions)

FunctionDescriptionExample`translateText()`Translate text`translateText('Hello', 'es')``translate()`Full translation`translate('Hello', 'fr')``translate_batch()`Batch translate`translate_batch(['Hi', 'Bye'], 'de')``detect_language()`Detect language`detect_language('Bonjour')``translate_array()`Array translation`translate_array($data, 'es')`---

### **Blade Directives**

[](#blade-directives)

DirectiveUsageExample`@translate`Inline translation`@translate('Welcome', 'es')``@translateStart/@translateEnd`Block translation`@translateStart('fr') ... @translateEnd``@detectLang`Detect language`@detectLang($text)`---

### **Artisan Commands**

[](#artisan-commands)

CommandDescription`translate:test`Test all translation services`translate:string {text} {target}`Translate a string`translate:file {source} {target}`Translate entire file`translate:sync --source=en --target=es,fr`Sync translations`translate:clear-cache`Clear cache---

🎯 Supported Languages
---------------------

[](#-supported-languages)

**100+ languages supported including:**

`ar` Arabic • `bn` Bengali • `zh` Chinese • `cs` Czech • `da` Danish • `nl` Dutch • `en` English • `fi` Finnish • `fr` French • `de` German • `el` Greek • `he` Hebrew • `hi` Hindi • `hu` Hungarian • `id` Indonesian • `it` Italian • `ja` Japanese • `ko` Korean • `ms` Malay • `no` Norwegian • `pl` Polish • `pt` Portuguese • `ro` Romanian • `ru` Russian • `es` Spanish • `sv` Swedish • `th` Thai • `tr` Turkish • `uk` Ukrainian • `ur` Urdu • `vi` Vietnamese

**And many more!** Check service documentation for complete list.

---

📊 Performance &amp; Benchmarks
------------------------------

[](#-performance--benchmarks)

### **Translation Speed**

[](#translation-speed)

OperationWithout CacheWith CacheImprovementSingle Translation~150ms~1ms**150x faster**Batch (50 items)~3000ms~50ms**60x faster**File Translation~5000ms~100ms**50x faster**### **Cache Hit Rates**

[](#cache-hit-rates)

In production environments with proper caching:

- 📈 Average cache hit rate: **85-95%**
- ⚡ Average response time: **2-5ms**
- 💾 Storage overhead: **Minimal**

---

🛡️ Security
-----------

[](#️-security)

### **Best Practices**

[](#best-practices)

```
// ✅ GOOD - Sanitize input
$cleanText = strip_tags($userInput);
$translation = Translate::translate($cleanText, 'es');

// ❌ BAD - Direct user input
$translation = Translate::translate($_POST['text'], 'es');

// ✅ GOOD - Rate limiting
use Illuminate\Support\Facades\RateLimiter;

if (RateLimiter::tooManyAttempts('translate:'.$request->ip(), 60)) {
    abort(429);
}
```

### **Data Privacy**

[](#data-privacy)

- ⚠️ Text is sent to third-party APIs
- ✅ No data stored on our servers
- ✅ HTTPS encryption for all requests
- ✅ Use Argos for sensitive data (offline)
- ✅ Cache can be encrypted

---

🤝 Contributing
--------------

[](#-contributing)

We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

### **Quick Contribution Steps**

[](#quick-contribution-steps)

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Write tests for your changes
4. Commit your changes (`git commit -m 'Add amazing feature'`)
5. Push to the branch (`git push origin feature/amazing-feature`)
6. Open a Pull Request

---

🆘 Troubleshooting
-----------------

[](#-troubleshooting)

### **LibreTranslate API Key Error?**

[](#libretranslate-api-key-error)

If you see: `"Visit https://portal.libretranslate.com to get an API key"`

**Solution 1: Use services that don't require API key (Default)**

```
# Package now uses Lingva by default (no API key needed)
php artisan translate:test
# Should show Lingva, Google, MyMemory working
```

**Solution 2: Get free LibreTranslate API key**

1. Visit
2. Sign up (100,000 characters/month FREE)
3. Add to `.env`:

```
TRANSLATE_LIBRE_ENABLED=true
TRANSLATE_LIBRE_API_KEY=your-api-key-here
```

**Solution 3: Self-host LibreTranslate**

```
docker run -d -p 5000:5000 libretranslate/libretranslate
```

```
TRANSLATE_LIBRE_ENDPOINT=http://localhost:5000
```

### **Translations not working?**

[](#translations-not-working)

1. Test services: `php artisan translate:test`
2. Check internet connectivity
3. Verify services are enabled in config
4. Clear cache: `php artisan translate:clear-cache`
5. Check logs: `storage/logs/laravel.log`

### **Cache not working?**

[](#cache-not-working)

```
php artisan config:clear
php artisan cache:clear
php artisan translate:clear-cache
```

### **Dashboard not accessible?**

[](#dashboard-not-accessible)

Make sure routes are loaded and middleware is not blocking access.

### **Need Help?**

[](#need-help)

- 📖 Read the documentation above
- 🐛 [Report bugs](https://github.com/subhashladumor1/laravel-translate/issues)
- 💬 [Ask questions](https://github.com/subhashladumor1/laravel-translate/discussions)
- 📧 Email:

---

📜 License
---------

[](#-license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

---

💖 Credits
---------

[](#-credits)

- **Author:** [Subhash Ladumor](https://github.com/subhashladumor1)
- **Translation APIs:** LibreTranslate, Lingva, MyMemory, Google, Argos
- **Community:** All our amazing contributors

---

⭐ Show Your Support
-------------------

[](#-show-your-support)

If you find this package helpful, please consider:

- ⭐ Starring the repository
- 🐦 Sharing on social media
- 📝 Writing a blog post
- 💬 Telling your friends

---

### 🌟 Made with ❤️ for the Laravel Community

[](#-made-with-️-for-the-laravel-community)

**[Documentation](#-documentation)** • **[Examples](#-real-world-examples)** • **[Contributing](CONTRIBUTING.md)** • **[License](LICENSE)**

---

**Ready to make your Laravel app multilingual?** Install now and start translating! 🚀

```
composer require subhashladumor1/laravel-translate
```

###  Health Score

39

—

LowBetter than 87% of packages

Maintenance74

Regular maintenance activity

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

4

Last Release

147d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f38ba994870f0b2c8855e3f4614b1a8ecfecda7114fa4a8d261b9c6bb192b20b?d=identicon)[subhashladumor1](/maintainers/subhashladumor1)

---

Top Contributors

[![subhashladumor1](https://avatars.githubusercontent.com/u/79623012?v=4)](https://github.com/subhashladumor1 "subhashladumor1 (13 commits)")

---

Tags

google-translategoogle-translate-apilaravellaravel-frameworklaravel-packagelaravel-translatephpphp-frameworkphp-librarysubhashsubhash-ladumorsubhashladumortranslatetranslate-apilaravellocalizationi18ntranslatetranslationmultilinguallibretranslatelingvamymemoryfree-translationbatch-translationoffline-translation

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/subhashladumor1-laravel-translate/health.svg)

```
[![Health](https://phpackages.com/badges/subhashladumor1-laravel-translate/health.svg)](https://phpackages.com/packages/subhashladumor1-laravel-translate)
```

###  Alternatives

[omaralalwi/lexi-translate

Laravel translation package with morph relationships and caching.

733.2k2](/packages/omaralalwi-lexi-translate)[jayesh/laravel-gemini-translator

An interactive command to extract and generate Laravel translations using Gemini AI.

691.7k](/packages/jayesh-laravel-gemini-translator)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
