Download the PHP package subhashladumor1/laravel-translate without Composer

On this page you can find all versions of the php package subhashladumor1/laravel-translate. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-translate

# ๐ŸŒ Laravel Translate ### Professional Multi-Source Translation Package for Laravel 11+ [![Latest Version](https://img.shields.io/packagist/v/subhashladumor1/laravel-translate.svg?style=flat-square)](https://packagist.org/packages/subhashladumor1/laravel-translate) [![Laravel Version](https://img.shields.io/badge/Laravel-12.x-red.svg?style=flat-square)](https://laravel.com) [![License](https://img.shields.io/packagist/l/subhashladumor1/laravel-translate.svg?style=flat-square)](https://packagist.org/packages/subhashladumor1/laravel-translate) [![PHP Version](https://img.shields.io/packagist/php-v/subhashladumor1/laravel-translate.svg?style=flat-square)](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?

๐ŸŽฏ 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

### ๐Ÿ”ฅ 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 - โœ… **5 Powerful CLI Commands** - โœ… **Blade Directives** - โœ… **Helper Functions** - โœ… **Facade Support** - โœ… **Auto-Locale Middleware** - โœ… **Queue Integration** - โœ… **Analytics Dashboard** - โœ… **Translation Logging** - โœ… **Service Testing Tool**

๐Ÿ“ฆ Installation

Step 1: Install via Composer

Step 2: Publish Configuration (Optional)

Step 3: Configure (Optional)

Add to your .env file:

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


๐Ÿš€ Quick Start

๐Ÿ’ก Translate in 3 Ways

1๏ธโƒฃ Using Helper Function

2๏ธโƒฃ Using Facade

3๏ธโƒฃ In Blade Templates


๐Ÿ“– Complete Documentation

๐ŸŽฏ Basic Usage

Translate Text

Detect Language

Batch Translation


๐ŸŽจ Blade Directives

@translate Directive

Block Translation

Forms with Translation


๐Ÿ”ง CLI Commands

1. Test Services

This command helps you:

2. Translate String

3. Translate Files

4. Sync Translations

5. Clear Cache


๐ŸŽฏ Advanced Features

Middleware - Auto Locale Detection

Register the middleware in your Laravel app:

Apply to routes:

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

For large translation jobs:

Configure queue settings in config/translate.php:


๐Ÿ“Š Analytics Dashboard

Access the beautiful analytics dashboard:

Monitor:

Protect the dashboard (recommended):


โš™๏ธ Configuration

Service Configuration

Edit config/translate.php:

Cache Drivers

For Production (Redis - Recommended):

For Development (File):

For Database:


๐ŸŒ Supported Translation Services

Service Speed Quality API Key Offline Rate Limit Status
๐ŸŸข 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:


๐Ÿ”‘ 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 https://portal.libretranslate.com
  2. Sign up (no credit card required)
  3. Get your API key from dashboard

Step 2: Configure Laravel

Add to .env:

Step 3: Test

Alternative: Self-Host LibreTranslate

Then configure:


๐Ÿ”Œ Offline Translation (Argos)

Setup Argos Translate for offline use:

  1. Install Argos:

  2. Run Argos server:

  3. Enable in config:

Perfect for:


๐Ÿ’ผ Real-World Examples

E-commerce Product Translation

Multi-Language Blog

Dynamic Contact Form

Automated Language File Sync


๐ŸŽ“ API Reference

Facade Methods

Translate::translate()

Translates text to the target language.

Translate::translateBatch()

Translates multiple texts at once.

Translate::detectLanguage()

Detects the language of given text.

Translate::clearCache()

Clears all translation cache.

Translate::getAnalytics()

Returns analytics data including cache stats and latency.


Helper Functions

Function Description Example
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

Directive Usage Example
@translate Inline translation @translate('Welcome', 'es')
@translateStart/@translateEnd Block translation @translateStart('fr') ... @translateEnd
@detectLang Detect language @detectLang($text)

Artisan Commands

Command Description
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

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 & Benchmarks

Translation Speed

Operation Without Cache With Cache Improvement
Single Translation ~150ms ~1ms 150x faster
Batch (50 items) ~3000ms ~50ms 60x faster
File Translation ~5000ms ~100ms 50x faster

Cache Hit Rates

In production environments with proper caching:


๐Ÿ›ก๏ธ Security

Best Practices

Data Privacy


๐Ÿค Contributing

We welcome contributions! Please see CONTRIBUTING.md for details.

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

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)

Solution 2: Get free LibreTranslate API key

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

Solution 3: Self-host LibreTranslate

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?

Dashboard not accessible?

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

Need Help?


๐Ÿ“œ License

This package is open-sourced software licensed under the MIT license.


๐Ÿ’– Credits


โญ Show Your Support

If you find this package helpful, please consider:


### ๐ŸŒŸ 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! ๐Ÿš€


All versions of laravel-translate with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1|^8.2|^8.3
illuminate/support Version ^9.0|^10.0|^11.0|^12.0
illuminate/http Version ^9.0|^10.0|^11.0|^12.0
illuminate/cache Version ^9.0|^10.0|^11.0|^12.0
illuminate/session Version ^9.0|^10.0|^11.0|^12.0
illuminate/database Version ^9.0|^10.0|^11.0|^12.0
illuminate/view Version ^9.0|^10.0|^11.0|^12.0
guzzlehttp/guzzle Version ^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package subhashladumor1/laravel-translate contains the following files

Loading the files please wait ...