Download the PHP package darvis/laravel-google-translate without Composer
On this page you can find all versions of the php package darvis/laravel-google-translate. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download darvis/laravel-google-translate
More information about darvis/laravel-google-translate
Files in darvis/laravel-google-translate
Package laravel-google-translate
Short Description Translate text, HTML and Eloquent models in Laravel with the Google Cloud Translation API, with one row per locale linked through a pid column.
License MIT
Homepage https://arviddejong.github.io/laravel-google-translate/
Informations about the package laravel-google-translate
Laravel Google Translate
Translate text, HTML and Eloquent models in Laravel with the Google Cloud Translation API (v2, with an API key). A translated model is stored as a new row in the same table, with pid pointing at the source row. The package does not translate your lang/ files, and it does not cache or queue by itself.
Features
- Text, HTML and batches - HTML keeps its tags, a batch is one request
- Translatable models - a trait for models with one row per locale, linked through a
pidcolumn - Nothing to catch - a failed API call is logged and returns
null, or[]for a batch; it never throws - No double costs for models - an existing translation is returned, and only empty fields are filled
- Testable - every call goes through Laravel's HTTP client, so
Http::fake()replaces Google - Safe with your key - sent in a header, never in a URL that can end up in a log
- Laravel Boost - guideline and skill included, so an AI assistant in your app knows the API
Requirements
- PHP 8.2 or higher
- Laravel 11, 12 or 13 (Laravel 13 itself needs PHP 8.3)
- A Google Cloud Translation API key, from a Google Cloud project with billing enabled
Installation
The installation page explains where the key comes from and how to check that it works.
Quick start
For a model, add a locale and a nullable pid column to the table and the trait to the model:
Documentation
The full documentation lives on the documentation site:
- Installation: the package, the API key, the settings and a check that it works
- Quick start: a translatable model from migration to translated row
- Concepts: the table layout, failed calls, the API key and the costs
- API reference: every public method
- CMS integration: a Livewire screen with missing translations and a translate button
- Testing: test your code without calling Google
- Troubleshooting:
nullcomes back, and the log lines that say why - FAQ: short answers
Laravel Boost
The package ships a Laravel Boost guideline and a skill. Run php artisan boost:install, or php artisan boost:update --discover in a project that already uses Boost.
Testing
The package's own suite never calls Google:
Changelog
See CHANGELOG.
Support the package
If darvis/laravel-google-translate saves you time, buy me a beer 🍺: sponsor me on GitHub.
Contributing
See CONTRIBUTING.
Security
Please report a vulnerability privately, as described in SECURITY, not in the issue tracker.
License
The MIT License (MIT). See LICENSE.
All versions of laravel-google-translate with dependencies
illuminate/database Version ^11.0|^12.0|^13.0
illuminate/http Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0