Google-Translate-PHP
====================

Google Translate API free PHP class. Translates totally free of charge.

## Usage

Instantiate GoogleTranslate object
```php
$tr = new GoogleTranslate("en", "ka");
```
or set/change languages later
```php
$tr = new GoogleTranslate();
$tr->setLangFrom("en");
$tr->setLangTo("ka");
```
translate sentences
```php
echo $tr->translate("Hello World!");
```
Also, you can use shorter syntax:
```php
echo $tr->setLangFrom("en")->setLangTo("ru")->translate("Goodbye");
```
Or call a static method
```php
echo GoogleTranslate::staticTranslate("Hello again", "en", "ka");
```
    
    

Google-Translate-PHP
====================

Google Translate API free PHP class. Translates totally free of charge.

## Installation

Installing this package through [Composer](https://getcomposer.org/). Edit your project's `composer.json` file to require `stichoza/google-translate-php`.

```json
"require": {
    "stichoza/google-translate-php": "~2.0"
}
```

## Usage

Instantiate GoogleTranslate object
```php
$tr = new GoogleTranslate("en", "ka");
```
or set/change languages later
```php
$tr = new GoogleTranslate();
$tr->setLangFrom("en");
$tr->setLangTo("ka");
```
translate sentences
```php
echo $tr->translate("Hello World!");
```
Also, you can use shorter syntax:
```php
echo $tr->setLangFrom("en")->setLangTo("ru")->translate("Goodbye");
```
Or call a static method
```php
echo GoogleTranslate::staticTranslate("Hello again", "en", "ka");
```
    
    

Add composer info to readme
Add composer info to readme
