2017 © Pedro Peláez
 

yii2-extension yii2-google-api

Component for work with google api based on google/apiclient

image

skeeks/yii2-google-api

Component for work with google api based on google/apiclient

  • Monday, March 28, 2016
  • by skeeks-semenov
  • Repository
  • 1 Watchers
  • 0 Stars
  • 3,189 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 30 % Grown

The README.md

Component for work with official google api

Partly wrapper over powerful official package from google — google/apiclient, (*1)

Latest Stable Version Total Downloads, (*2)

Installation

The preferred way to install this extension is through composer., (*3)

Either run, (*4)

php composer.phar require --prefer-dist skeeks/yii2-google-api "^2.0.1"

or add, (*5)

"skeeks/yii2-google-api": "^2.0.1"

How to use

Configuration app

//App config
[
    'components'    =>
    [
    //....
        'googleApi' =>
        [
            'class'       => '\skeeks\yii2\googleApi\GoogleApi',
            'key'         => 'YOUR_GOOLE_API_KEY',
        ],
    //....
    ]
]

An example of the Api transliteration

https://cloud.google.com/translate/v2/using_rest, (*6)

Translate "apple", (*7)

$result = \Yii::$app->googleApi->serviceTranslate->translate('apple', 'ru');
print_r($result);

or, (*8)

$result = \Yii::$app->googleApi->serviceTranslate->googleService->translations->listTranslations('apple', 'ru');
print_r($result);

or, (*9)

$googleService = \Yii::$app->googleApi->serviceTranslate->googleService;
$result = $googleService->translations->listTranslations('apple', 'ru');
print_r($result);

or, (*10)

$googleClient = \Yii::$app->googleApi->googleClient;
$googleService = new \Google_Service_Translate($googleClient);
$result = $googleService->translations->listTranslations('apple', 'ru');
print_r($result);
$service = \Yii::$app->googleApi->serviceTranslate->googleService;
$result = $service->languages->listLanguages([
    'target' => 'ru'
]);
print_r($result);

An example other google services


$googleClient = \Yii::$app->googleApi->googleClient; $googleServiceAdsense = new \Google_Service_Adsense($googleClient); $googleServiceAdsense = new \Google_Service_Youtube($googleClient); //....

Your Google Services

//App config
[
    'components'    =>
    [
    //....
        'googleApi' =>
        [
            'class'       => '\skeeks\yii2\googleApi\GoogleApi',
            'key'         => 'YOUR_GOOLE_API_KEY',

            'serviceTranslateClass' => 'skeeks\cms\googleApi\serviceTranslate\GoogleApiServiceTranslate'

            //or

            'serviceTranslateClass' => [
                'class' => 'skeeks\cms\googleApi\serviceTranslate\GoogleApiServiceTranslate',

                'option' => 'value'
            ],
        ],
    //....
    ]
]


skeeks!
SkeekS CMS (Yii2) — quickly, easily and effectively!
skeeks.com | cms.skeeks.com, (*11)

The Versions

28/03 2016

dev-master

9999999-dev http://skeeks.com

Component for work with google api based on google/apiclient

  Sources   Download

GPL-3.0+

The Requires

 

by Semenov Alexander

api component yii2 yii google skeeks

28/03 2016

1.0.0

1.0.0.0 http://skeeks.com

Component for work with google api based on google/apiclient

  Sources   Download

GPL-3.0+

The Requires

 

by Semenov Alexander

api component yii2 yii google skeeks