flowpack/googleapiclient
Composer 安装命令:
composer require flowpack/googleapiclient
包简介
Google Api Client provider for Neos Flow
README 文档
README
A package that provides Neos Flow & CMS packages with authentication and helpers for the Google API Client.
Installation
Add the dependency to your site package like this:
composer require --no-update flowpack/googleapiclient
And then run composer update in your project's root folder.
Configuration
Authentication
First retrieve your auth.json file from Google.
To allow the API client to authenticate, you either have to store the credentials via the following command:
./flow googleapi:storecredentials auth.json
Or set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the path where you store your auth.json.
Application name
Set your application name in your Settings.yaml like this:
Flowpack:
GoogleApiClient:
applicationName: 'My app'
Usage
Add an Objects.yaml to your package's Configuration folder with the following content and adapt to your service name:
Vendor\Package\Service\MyGoogleService:
arguments:
1:
object:
factoryObjectName: Flowpack\GoogleApiClient\Service\ClientFactory
factoryMethodName: create
Then have your MyGoogleService class look like this:
<?php
namespace Vendor\Package\Service;
use Google_Client;
use Neos\Flow\Annotations as Flow;
/**
* My Google API service
*
* @Flow\Scope("singleton")
*/
class MyGoogleService extends \Google_Service_Webmasters
{
/**
* @inheritdoc
*/
public function __construct(Google_Client $client)
{
parent::__construct($client);
$client->addScope(\Google_Service_Webmasters::WEBMASTERS);
}
}
In this example it would use the API for the Google Webmasters endpoints.
You can adjust this to the API you need by changing the inheritance and setting the correct scope in the constructor.
Finally implement the methods for accessing the API and inject the service wherever you need it.
flowpack/googleapiclient 适用场景与选型建议
flowpack/googleapiclient 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 97.03k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 03 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 flowpack/googleapiclient 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 flowpack/googleapiclient 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 97.03k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 14
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2019-03-27