You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And then browsing to the host and port you specified
63
63
(in the above example, `http://localhost:8000`).
64
64
65
-
```PHP
65
+
```php
66
66
// include your composer dependencies
67
67
require_once 'vendor/autoload.php';
68
68
@@ -79,6 +79,33 @@ foreach ($results as $item) {
79
79
}
80
80
```
81
81
82
+
### Caching ###
83
+
84
+
It is recommended to use another caching library to improve performance. This can be done by passing a [PSR-6](http://www.php-fig.org/psr/psr-6/) compatible library to the client:
85
+
86
+
```php
87
+
$cache = new Stash\Pool(new Stash\Driver\FileSystem);
88
+
$client->setCache($cache);
89
+
```
90
+
91
+
In this example we use [StashPHP](http://www.stashphp.com/). Add this to your project with composer:
92
+
93
+
```
94
+
composer require tedivm/stash
95
+
```
96
+
97
+
### Updating Tokens ###
98
+
99
+
When using [Refresh Tokens](https://developers.google.com/identity/protocols/OAuth2InstalledApp#refresh) or [Service Account Credentials](https://developers.google.com/identity/protocols/OAuth2ServiceAccount#overview), it may be useful to perform some action when a new access token is granted. To do this, pass a callable to the `setTokenCallback` method on the client:
100
+
101
+
```php
102
+
$logger = new Monolog\Logger;
103
+
$tokenCallback = function ($cacheKey, $accessToken) use ($logger) {
104
+
$logger->debug(sprintf('new access token received at cache key %s', $cacheKey));
For support with the library the best place to ask is via the google-api-php-client tag on StackOverflow: http://stackoverflow.com/questions/tagged/google-api-php-client
117
+
For support with the library the best place to ask is via the google-api-php-client tag on StackOverflow: http://stackoverflow.com/questions/tagged/google-api-php-client
91
118
92
-
If there is a specific bug with the library, please file a issue in the Github issues tracker, including a (minimal) example of the failing code and any specific errors retrieved. Feature requests can also be filed, as long as they are core library requests, and not-API specific: for those, refer to the documentation for the individual APIs for the best place to file requests. Please try to provide a clear statement of the problem that the feature would address.
119
+
If there is a specific bug with the library, please [file a issue](/Google/google-api-php-client/issues) in the Github issues tracker, including an example of the failing code and any specific errors retrieved. Feature requests can also be filed, as long as they are core library requests, and not-API specific: for those, refer to the documentation for the individual APIs for the best place to file requests. Please try to provide a clear statement of the problem that the feature would address.
0 commit comments