PHPackages                             bscheshirwork/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. bscheshirwork/yii2-google-apiclient

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

bscheshirwork/yii2-google-apiclient
===================================

A Yii2 wrapper for the official Google API PHP Client

014.3k↓38.2%1PHP

Since Oct 23Pushed 8y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

A Yii2 wrapper for the official Google API PHP Client.

This extension features:

- 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 way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist bscheshirwork/yii2-google-apiclient "*"

```

or add

```
"bscheshirwork/yii2-google-apiclient": "*"

```

to the require section of your `composer.json` file.

This package will also install the [google/apiclient](http://github.com/google/apiclient) library.

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', 'google_apiclient'],
'modules' => [
    'google_apiclient' => [
        'class' => 'bscheshirwork\yii2\google\apiclient\Module',
    ],
],
```

- Use the /configure sub command:

```
./yii google_apiclient/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' => [
        // ..
        'gmail' => [
            'class' => 'bscheshirwork\yii2\google\apiclient\components\GoogleApiClient',
            'credentialsPath' => '@runtime/google-apiclient/auth.json',
            'clientSecretPath' => '@runtime/google-apiclient/gmail.json',
            'api' => Google_Service_Gmail::class,
        ],
```

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

Usage
-----

[](#usage)

**Displaying your newest message subject on GMail**

```
/**
 * @var $service Google_Service_Gmail
 */
$service = Yii::$app->gmail->getService();

$messages = $service->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 = $service->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 . "";
        }
    }

}
```

This documentation is available [online](http://machour.idk.tn/yii/machour/yii2-google-apiclient)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/f0ca6fce2d5266292b630055490f861168f8c52fe5199e7f654eebbc8b7ecb92?d=identicon)[bscheshirwork](/maintainers/bscheshirwork)

---

Top Contributors

[![bscheshirwork](https://avatars.githubusercontent.com/u/5769211?v=4)](https://github.com/bscheshirwork "bscheshirwork (10 commits)")[![machour](https://avatars.githubusercontent.com/u/304450?v=4)](https://github.com/machour "machour (8 commits)")[![dmytroraschepkin](https://avatars.githubusercontent.com/u/7814293?v=4)](https://github.com/dmytroraschepkin "dmytroraschepkin (4 commits)")

### Embed Badge

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

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

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