PHPackages                             idk/yii2-google-apiclient - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. idk/yii2-google-apiclient

ActiveYii2-extension[API Development](/categories/api)

idk/yii2-google-apiclient
=========================

A Yii2 wrapper for the official Google API PHP Client

2.1.0(4y ago)720.3k↓26.5%3[1 issues](https://github.com/idk-tn/yii2-google-apiclient/issues)MITPHP

Since Nov 17Pushed 4y ago2 watchersCompare

[ Source](https://github.com/idk-tn/yii2-google-apiclient)[ Packagist](https://packagist.org/packages/idk/yii2-google-apiclient)[ Docs](https://github.com/idk-tn/yii2-google-apiclient)[ RSS](/packages/idk-yii2-google-apiclient/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (4)Used By (0)

yii2-google-apiclient
=====================

[](#yii2-google-apiclient)

A Yii2 wrapper for the official Google API PHP Client.

[![Latest Stable Version](https://camo.githubusercontent.com/3da16ea0531f007c8bee7b43f9ddd585b81110913d34a8d30a9a7a6796e4c5f6/68747470733a2f2f706f7365722e707567782e6f72672f69646b2f796969322d676f6f676c652d617069636c69656e742f76657273696f6e)](https://packagist.org/packages/idk/yii2-google-apiclient)[![Latest Unstable Version](https://camo.githubusercontent.com/0b60d803db5bdfe021e9e6128f2ec85be0072e3250c0749207ff789d2c71aacb/68747470733a2f2f706f7365722e707567782e6f72672f69646b2f796969322d676f6f676c652d617069636c69656e742f762f756e737461626c65)](//packagist.org/packages/idk/yii2-google-apiclient)[![License](https://camo.githubusercontent.com/9047b3b5c5629cbc395b3eeb5e7f148f9a43745a6ae58a336a10529af17fc82d/68747470733a2f2f706f7365722e707567782e6f72672f69646b2f796969322d676f6f676c652d617069636c69656e742f6c6963656e7365)](https://packagist.org/packages/idk/yii2-google-apiclient)[![Total Downloads](https://camo.githubusercontent.com/e0dfd7d96495d90acf93bf4c8d480a2d0acac4ebed36f53e2aef2b18623dc75a/68747470733a2f2f706f7365722e707567782e6f72672f69646b2f796969322d676f6f676c652d617069636c69656e742f646f776e6c6f616473)](https://packagist.org/packages/idk/yii2-google-apiclient)

This extension comes with:

- A console utility to generate your credentials files
- A component that will take care of the authentication, and give you access to the service

Installation
------------

[](#installation)

The preferred method of installation is via [Packagist](https://packagist.org) and [Composer](https://getcomposer.org/download/). Run the following command to install the package and add it as a requirement to your project's `composer.json`:

```
composer require idk/yii2-google-apiclient
```

Configuration
-------------

[](#configuration)

**Credentials file**

In order to use this extension, you will be needing a credentials file for your Google Application.

You can generate this file using the provided console utility:

- Configure the module in `config/console.php`:

```
'bootstrap' => ['log', 'yii2gac'],
'modules' => [
    'yii2gac' => [
        'class' => 'idk\yii2\google\apiclient\Module',
    ],
],
```

- Use the /configure sub command:

```
./yii yii2gac/configure  [api]
```

where `clientSecretPath` is the path to your secret JSON file obtained from the [Google Console](https://console.developers.google.com/) and `api` the api identifier (it will be prompted for if not provided).

**Components**

You application may use as much Google\_Service instances as you need, by adding an entry into the `components` index of the Yii configuration array.

Here's how to setup GMail for example, a usage sample is provided below.

```
    'components' => [
        // ..
        'google' => [
            'class' => 'idk\yii2\google\apiclient\components\GoogleApiClient',
            'credentialsPath' => '@runtime/google-apiclient/auth.json',
            'clientSecretPath' => '@runtime/google-apiclient/secret.json',
        ],
```

This will enable you to access the GMail authenticated service `Yii::$app->google->getService()` in your application.

Sample usage
------------

[](#sample-usage)

**Displaying your newest message subject on GMail**

```
$gmail = new \Google_Service_Gmail(Yii::$app->google->getService());

$messages = $gmail->users_messages->listUsersMessages('me', [
    'maxResults' => 1,
    'labelIds' => 'INBOX',
]);
$list = $messages->getMessages();

if (count($list) == 0) {
    echo "You have no emails in your INBOX .. how did you achieve that ??";
} else {
    $messageId = $list[0]->getId(); // Grab first Message

    $message = $gmail->users_messages->get('me', $messageId, ['format' => 'full']);

    $messagePayload = $message->getPayload();
    $headers = $messagePayload->getHeaders();

    echo "Your last email subject is: ";
    foreach ($headers as $header) {
        if ($header->name == 'Subject') {
            echo "" . $header->value . "";
        }
    }

}
```

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~709 days

Total

3

Last Release

1685d ago

Major Versions

1.1.0 → 2.0.02021-10-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/50430982793b695a5a9a886a81b976606c71062b49cf38c12509801b1845b1b2?d=identicon)[machour](/maintainers/machour)

---

Top Contributors

[![machour](https://avatars.githubusercontent.com/u/304450?v=4)](https://github.com/machour "machour (12 commits)")

---

Tags

google-apioauth2yii2apigoogleyii2

### Embed Badge

![Health badge](/badges/idk-yii2-google-apiclient/health.svg)

```
[![Health](https://phpackages.com/badges/idk-yii2-google-apiclient/health.svg)](https://phpackages.com/packages/idk-yii2-google-apiclient)
```

###  Alternatives

[skeeks/yii2-google-api

Component for work with google api based on google/apiclient

1243.1k1](/packages/skeeks-yii2-google-api)[dotzero/yii2-amocrm

Расширение для Yii Framework 2 реализующее клиент для работы с API amoCRM

1639.7k](/packages/dotzero-yii2-amocrm)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
