dktw / google-api-bundle
此包的最新版本(dev-main)没有提供许可证信息。
Google API 客户端 Symfony 包
dev-main
2022-03-17 22:26 UTC
Requires
- google/apiclient: ^2.0
- symfony/framework-bundle: ~4.0||~5.0||~6.0
Requires (Dev)
This package is auto-updated.
Last update: 2024-09-23 00:15:31 UTC
README
本项目提供了一个简单的 symfony 包,用于将可配置的 Google API 客户端 作为 symfony 服务提供。
用法
安装
将此项目包含在您的 Composer 安装中。
composer require double-star-systems/google-api-bundle
配置
该模块无需重大配置即可正常工作。至少,您必须创建 google api 的 credentials.json
文件。此文件可以放在默认位置 config/google_api_bundle/credentials.json
,或者放在自定义位置,这需要在应用程序中进行配置。
您可以在应用程序中添加以下自定义配置。
# config/packages/google_api.yaml google_api: scopes: - https://www.googleapis.com/auth/drive credentials_file: `path/to/your/credentials.json` token_file: `path/to/your/tokens.json` application_name: 'Your Awesome App Name!'
使用服务
要在您的应用程序中使用此服务,您可以在项目中简单地使用标准的 google api 类,并拥有一个完全配置的 base api 客户端实例。
use Google\Client; class ExampleController extends AbstractController { #[Route('/example, 'example')] public function example(Client $client) { // use the $client instance as normal. } }
需求
本项目配置为与 Symfony 4+ 和 Google PHP API 客户端库 2.0 兼容。
支持
本项目由 Double Star Systems 开发。有关项目支持或报告错误的问题,请 在 GitHub 上创建问题