https://github.com/dejurin/php-google-translate-for-free
Library for free use Google Translator. With attempts connecting on failure and array support.
https://github.com/dejurin/php-google-translate-for-free
detect-language google-translate google-translator language-detection php translate translation translator
Last synced: 5 months ago
JSON representation
Library for free use Google Translator. With attempts connecting on failure and array support.
- Host: GitHub
- URL: https://github.com/dejurin/php-google-translate-for-free
- Owner: dejurin
- License: mit
- Created: 2018-03-02T19:36:10.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-09-29T17:47:00.000Z (over 1 year ago)
- Last Synced: 2024-10-20T09:18:40.360Z (over 1 year ago)
- Topics: detect-language, google-translate, google-translator, language-detection, php, translate, translation, translator
- Language: PHP
- Size: 45.9 KB
- Stars: 134
- Watchers: 9
- Forks: 48
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# GoogleTranslateForFree
Packagist: https://packagist.org/packages/dejurin/php-google-translate-for-free

[](https://packagist.org/packages/dejurin/php-google-translate-for-free)
[](https://github.styleci.io/repos/123622379)
Library for free use Google Translator. With attempts connecting on failure and array support.
---
[](https://buymeacoffee.com/deyurii)
---
## Installation
Install this package via [Composer](https://getcomposer.org/).
```
composer require dejurin/php-google-translate-for-free
```
Or edit your project's `composer.json` to require `dejurin/php-google-translate-for-free` and then run `composer update`.
```json
"require": {
"dejurin/php-google-translate-for-free": "^1.0"
}
```
## Usage
```php
require_once ('vendor/autoload.php');
use \Dejurin\GoogleTranslateForFree;
```
## Single
```php
$source = 'en';
$target = 'ro';
$attempts = 5;
$text = 'Hello';
$tr = new GoogleTranslateForFree();
$result = $tr->translate($source, $target, $text, $attempts);
var_dump($result);
/*
string(24) "Salut"
*/
```
## Array
```php
$source = 'en';
$target = 'ro';
$attempts = 5;
$arr = ['hello','world'];
$tr = new GoogleTranslateForFree();
$result = $tr->translate($source, $target, $arr, $attempts);
var_dump($result);
/*
array(2) {
[0]=>
string(24) "salut"
[1]=>
string(6) "lume"
}
*/
```
### License ###
This source code is distributed under [MIT](https://choosealicense.com/licenses/mit/) license.
___
## Sponsors ##
### https://currencyrate.today ###
### https://moneyconvert.net/ ###
### https://co-w.io/ ###
### https://co-in.io/ ###
### https://fx-w.io/ ###