https://github.com/flowpack/flowpack.googleapiclient
Simplifies integrating the Google PHP Api Client into Flow / Neos CMS apps
https://github.com/flowpack/flowpack.googleapiclient
Last synced: 6 months ago
JSON representation
Simplifies integrating the Google PHP Api Client into Flow / Neos CMS apps
- Host: GitHub
- URL: https://github.com/flowpack/flowpack.googleapiclient
- Owner: Flowpack
- License: gpl-3.0
- Created: 2019-03-27T08:01:09.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-04-22T16:05:40.000Z (almost 4 years ago)
- Last Synced: 2025-04-13T05:04:00.411Z (11 months ago)
- Language: PHP
- Size: 23.4 KB
- Stars: 0
- Watchers: 12
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# flowpack-googleapiclient
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](https://cloud.google.com/docs/authentication/production).
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:
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.