https://github.com/datlechin/laravel-google-translate
Free Google Translate API for Laravel application.
https://github.com/datlechin/laravel-google-translate
Last synced: 2 months ago
JSON representation
Free Google Translate API for Laravel application.
- Host: GitHub
- URL: https://github.com/datlechin/laravel-google-translate
- Owner: datlechin
- License: mit
- Created: 2023-05-29T14:43:49.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-26T06:51:25.000Z (4 months ago)
- Last Synced: 2025-03-23T19:45:17.946Z (3 months ago)
- Language: PHP
- Size: 12.7 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Laravel Google Translate
[](https://packagist.org/packages/datlechin/laravel-google-translate)
[](https://packagist.org/packages/datlechin/laravel-google-translate)This package allows you to free translate your Laravel app easily using the Google Translate API.
## Installation
You can install the package via composer:
```bash
composer require datlechin/laravel-google-translate
```## Usage
```php
use Datlechin\GoogleTranslate\Facades\GoogleTranslate;// Using facade
$result = GoogleTranslate::source('en')
->target('vi')
->translate('Hello world!');$result->translatedText(); // Chào thế giới!
$result->getAlternativeTranslations();
//[
// [
// 0 => 'Chào thế giới!',
// 1 => 'Xin chào thế giới!',
// 2 => 'Chào cả thế giới!',
// ],
//]$result->getSourceText(); // Hello world!
$result->getSourceLanguage(); // en
```## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
### Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
## Credits
- [Ngo Quoc Dat](https://github.com/datlechin)
- [All Contributors](../../contributors)## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.