{"id":19818455,"url":"https://github.com/bscheshirwork/yii2-google-api-client-sa","last_synced_at":"2025-10-13T17:38:25.056Z","repository":{"id":56951427,"uuid":"96537880","full_name":"bscheshirwork/yii2-google-api-client-sa","owner":"bscheshirwork","description":"A Yii2 wrapper for the official Google API PHP Client (In case used Service Account + DwD)","archived":false,"fork":false,"pushed_at":"2017-07-11T07:32:49.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T19:59:39.729Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bscheshirwork.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-07T12:47:50.000Z","updated_at":"2017-07-07T12:48:10.000Z","dependencies_parsed_at":"2022-08-21T03:40:16.916Z","dependency_job_id":null,"html_url":"https://github.com/bscheshirwork/yii2-google-api-client-sa","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bscheshirwork/yii2-google-api-client-sa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bscheshirwork%2Fyii2-google-api-client-sa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bscheshirwork%2Fyii2-google-api-client-sa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bscheshirwork%2Fyii2-google-api-client-sa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bscheshirwork%2Fyii2-google-api-client-sa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bscheshirwork","download_url":"https://codeload.github.com/bscheshirwork/yii2-google-api-client-sa/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bscheshirwork%2Fyii2-google-api-client-sa/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279016368,"owners_count":26085828,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T10:15:42.040Z","updated_at":"2025-10-13T17:38:25.005Z","avatar_url":"https://github.com/bscheshirwork.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"A Yii2 wrapper for the official Google API PHP Client (In case used Service Account + DwD)\n------------\n\nFor easily config and give you access to the service\n\nInstallation\n------------\n\nFirst you can register Google service account with DwD, user for this account and enable G suite access for this user id.\n[api-client-library service-accounts](https://developers.google.com/api-client-library/php/auth/service-accounts)\n\nSecond - install wrapper and configure it use secret data.\n\n\n\nThe preferred way to install this extension is through [composer](http://getcomposer.org/download/).\n\nAdd\n\n```\n\"bscheshirwork/yii2-google-api-client-sa\": \"*\"\n```\n\nto the require section of your `composer.json` file.\n\nThis package will also install the [google/apiclient](http://github.com/google/apiclient) library.\n\nConfiguration\n-------------\n\nYou application may use as much Google_Service instances as you need, by adding an entry into the `components` index of the Yii configuration array.\n\nHere's how to setup GMail for example, a usage sample is provided below.\n\n```php\n    'components' =\u003e [\n        // ..\n        'gmail' =\u003e [\n            'class' =\u003e 'bscheshirwork\\gacsa\\GoogleApiClient',\n            'googleApplicationCredentials' =\u003e '@runtime/secret-place/myprojectname-privatekeyshortdigits.json',\n            'api' =\u003e Google_Service_Gmail::class,\n        ],\n```\n\nThis will enable you to access the GMail authenticated service `Yii::$app-\u003egmail-\u003egetService()` in your application.\n\nUsage\n-----\n\n**Displaying your newest message subject on GMail**\n\n```php\n/**\n * @var $service Google_Service_Gmail\n */\n$service = Yii::$app-\u003egmail-\u003egetService(function(){\n    $userToImpersonate = 'email@suitedomain.com';\n    /** @var \\Google_Client $client */\n    $client-\u003esetSubject($userToImpersonate);\n    return $client;\n});\n\n$messages = $service-\u003eusers_messages-\u003elistUsersMessages('me', [\n    'maxResults' =\u003e 1,\n    'labelIds' =\u003e 'INBOX',\n]);\n$list = $messages-\u003egetMessages();\n\n\nif (count($list) == 0) {\n    echo \"You have no emails in your INBOX .. how did you achieve that ??\";\n} else {\n    $messageId = $list[0]-\u003egetId(); // Grab first Message\n\n    $message = $service-\u003eusers_messages-\u003eget('me', $messageId, ['format' =\u003e 'full']);\n\n    $messagePayload = $message-\u003egetPayload();\n    $headers = $messagePayload-\u003egetHeaders();\n\n    echo \"Your last email subject is: \";\n    foreach ($headers as $header) {\n        if ($header-\u003ename == 'Subject') {\n            echo \"\u003cb\u003e\" . $header-\u003evalue . \"\u003c/b\u003e\";\n        }\n    }\n\n}\n```\n\nThanks [Mehdi Achour](https://github.com/machour/yii2-google-apiclient)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbscheshirwork%2Fyii2-google-api-client-sa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbscheshirwork%2Fyii2-google-api-client-sa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbscheshirwork%2Fyii2-google-api-client-sa/lists"}