luoksstudios/translate

Fast PHP translation library for 25+ languages including all Indian languages. By LUOKS STUDIOS.

Maintainers

Package info

github.com/LUOKSSTUDIOS/translate

pkg:composer/luoksstudios/translate

Statistics

Installs: 10

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.6.3 2026-02-28 09:18 UTC

This package is auto-updated.

Last update: 2026-03-28 09:34:25 UTC


README

Latest Version on Packagist Software License Build Status Total Downloads PHP Version

Premium, high-performance PHP translation library for 25+ languages, including all major Indian regional languages. Completely free with multi-layer caching and parallel engine support.

Developed with ❤️ by Chokshi Raj & LUOKS STUDIOS.

✨ Features

  • 🚀 Blazing Fast: Under 500ms per call.
  • 🇮🇳 Indian First: Full support for Hindi, Gujarati, Marathi, Bengali, Tamil, Telugu, and more.
  • 💸 100% Free: Works without expensive API keys or subscriptions.
  • 🧠 Smart Caching: Dual-layer system (In-Memory + File) for 0ms repeats.
  • Parallel Batching: Translate 10+ strings at once using multi-cURL.
  • 🛡️ Fallback Chain: Automatically switches between Google, MyMemory, and LibreTranslate if one fails.
  • 🎨 Embeddable Widget: One line of PHP to inject a fully protected, branded JS widget.
  • 🔌 Framework Ready: PSR-4 compliant; works with Laravel, WordPress, Symfony, etc.

📦 Installation

composer require luoksstudios/translate

🚀 Quick Start

use LuoksStudios\Translate\Translate;

// Simple one-liner
echo Translate::hindi('Welcome to our store'); 
// नमस्ते हमारे स्टोर में आपका स्वागत है

// Specific languages
echo Translate::to('gu', 'How are you?'); 
// તમે કેમ છો?

🛠️ Usage Examples

1. Basic Object Usage

use LuoksStudios\Translate\Translator;

$t = new Translator();
$result = $t->translate('Hello World', 'en', 'hi');

2. Magic Methods

echo $t->toGujarati('Good Morning');
echo $t->toMarathi('Thank you');
echo $t->toBengali('Welcome');

3. Parallel Batch Translation (Ultra Fast)

$texts = ['Home', 'Products', 'About Us', 'Contact'];
$translations = $t->batch($texts, 'en', 'hi');
// Parallel cURL makes this almost as fast as a single request!

4. Injection Widget

use LuoksStudios\Translate\Widget;

// Add this in your footer or layout
Widget::inject(['defaultLang' => 'hi']);

🏎️ Performance

Cache Level Speed Persistence
Memory (L1) 0-1ms Request Only
File (L2) 2-10ms Forever
API Call 200-500ms N/A

We utilize curl_multi_exec for batch translations, allowing us to send multiple requests simultaneously, providing a 10x speed improvement over sequential calls.

🤝 Integrations

Laravel

// In AppServiceProvider or any controller
use LuoksStudios\Translate\Translate;

Translate::configure([
    'cache_dir' => storage_path('framework/cache/luoks'),
    'engines' => ['google', 'mymemory']
]);

// In Blade
{{ Translate::hindi('Hello') }}

WordPress

// In functions.php
require_once __DIR__ . '/vendor/autoload.php';
use LuoksStudios\Translate\Widget;

add_action('wp_footer', function() {
    Widget::inject(['defaultLang' => 'hi']);
});

📄 License

The MIT License (MIT). Please see License File for more information.

🏢 About LUOKS STUDIOS

LUOKS STUDIOS is a professional technology agency specialized in high-performance digital products and open-source contributions.

© 2026 Chokshi Raj & LUOKS STUDIOS. All rights reserved.