Download the PHP package ferdiunal/laravel-translator without Composer
On this page you can find all versions of the php package ferdiunal/laravel-translator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ferdiunal/laravel-translator
More information about ferdiunal/laravel-translator
Files in ferdiunal/laravel-translator
Package laravel-translator
Short Description This package allows you to use freely available online translation tools in your project.
License MIT
Homepage https://github.com/ferdiunal/laravel-translator
Informations about the package laravel-translator
Laravel Translator
English | Türkçe
A type-safe and extensible translation package for Laravel applications with multiple provider support.
Supported providers:
- Google Translate
- Bing Translator
- DeepL
- MyMemory
- NLP Cloud
- OpenAI / OpenAI-compatible custom base URLs
Requirements
- PHP
^8.2— Laravel 13 combinations require PHP^8.3through Laravel's framework constraints. - Laravel 10, 11, 12, or 13.
Installation
Publish the configuration file:
Basic usage
Facade:
Helper:
Resolving a provider instance:
run() preserves Laravel placeholders. Placeholders such as :name and :count are not translated, and characters such as @ inside email addresses are not corrupted.
Provider keys and aliases
Canonical provider keys:
| Provider | Canonical key | Legacy/compatible alias |
|---|---|---|
google |
- | |
| Bing | bing |
- |
| DeepL | deepl |
- |
| MyMemory | mymemory |
myMemory |
| NLP Cloud | nlpcloud |
nlpCloud |
| OpenAI | openai |
- |
Acronym and case differences are no longer resolved through runtime class-name guessing. Provider resolution uses an explicit registry, so names such as OpenAI, DeepL, NLPCloud, and MyMemory are not fragile on Linux or PSR-4 case-sensitive environments.
Get the list of active providers:
Configuration
The published config/translator.php file contains these fields in summary:
The package does not ship a default secret or API key. API keys must be provided through .env.
Adding a custom provider
Custom provider classes must extend Ferdiunal\LaravelTranslator\Translators\Translator.
config/translator.php:
Usage:
Disabling or overriding providers
Disable a built-in provider:
Override built-in provider metadata or driver:
Invalid custom provider classes throw InvalidTranslatorProviderException; unknown or disabled providers throw UnsupportedTranslatorException.
Using OpenAI-compatible endpoints
The OpenAI provider supports OpenAI-compatible endpoints through OPENAI_BASE_URL:
Tests and quality gates
Single command:
The CI matrix is designed to cover PHP 8.2/8.3/8.4/8.5 and Laravel 10/11/12/13 combinations.
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-translator with dependencies
guzzlehttp/guzzle Version ^7.8
illuminate/contracts Version ^10.0||^11.0||^12.0||^13.0
illuminate/support Version ^10.0||^11.0||^12.0||^13.0
nlpcloud/nlpcloud-client Version ^1.0
openai-php/client Version ^0.10.3
php Version ^8.2
spatie/laravel-package-tools Version ^1.16
stichoza/google-translate-php Version ^5.2