luoksstudios/translate
Composer 安装命令:
composer require luoksstudios/translate
包简介
Fast PHP translation library for 25+ languages including all Indian languages. By LUOKS STUDIOS.
关键字:
README 文档
README
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.
- Lead Developer: Chokshi Raj (@chokshiraj)
- Website: luoksstudios.com
- Email: hello@luoksstudios.com
- GitHub: @LUOKSSTUDIOS
© 2026 Chokshi Raj & LUOKS STUDIOS. All rights reserved.
luoksstudios/translate 适用场景与选型建议
luoksstudios/translate 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「i18n」 「translation」 「translator」 「localization」 「multilingual」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 luoksstudios/translate 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 luoksstudios/translate 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 luoksstudios/translate 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Easy to use i18n translation PHP class for multi-language websites
A custom URL rule class for Yii 2 which allows to create translated URL rules
A Laravel Eloquent model trait for translatable resource
Bureaux A Partager Edit - Parse, validate, manipulate, and display dates in PHP w/ i18n support. Inspired by moment.js
Nette Framework adapter for I18n package
Yii2 integration for AirBnB Polyglot.js
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 37
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-28