在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):pulkitjalan/google-apiclient开源软件地址(OpenSource Url):https://github.com/pulkitjalan/google-apiclient开源编程语言(OpenSource Language):PHP 100.0%开源软件介绍(OpenSource Introduction):Google Api Client Wrapper
Requirements
InstallationInstall via composer composer require pulkitjalan/google-apiclient LaravelTo use in laravel add the following to the PulkitJalan\Google\GoogleServiceProvider::class Next add the following to the 'Google' => PulkitJalan\Google\Facades\Google::class Finally run Using an older version of PHP / Laravel?If you are on a PHP version below 8.0 or a Laravel version below 8.0 just use an older version of this package. UsageThe return [
/*
|----------------------------------------------------------------------------
| Google application name
|----------------------------------------------------------------------------
*/
'application_name' => '',
/*
|----------------------------------------------------------------------------
| Google OAuth 2.0 access
|----------------------------------------------------------------------------
|
| Keys for OAuth 2.0 access, see the API console at
| https://developers.google.com/console
|
*/
'client_id' => '',
'client_secret' => '',
'redirect_uri' => '',
'scopes' => [],
'access_type' => 'online',
'approval_prompt' => 'auto',
/*
|----------------------------------------------------------------------------
| Google developer key
|----------------------------------------------------------------------------
|
| Simple API access key, also from the API console. Ensure you get
| a Server key, and not a Browser key.
|
*/
'developer_key' => '',
/*
|----------------------------------------------------------------------------
| Google service account
|----------------------------------------------------------------------------
|
| Set the credentials JSON's location to use assert credentials, otherwise
| app engine or compute engine will be used.
|
*/
'service' => [
/*
| Enable service account auth or not.
*/
'enabled' => false,
/*
| Path to service account json file
*/
'file' => '',
],
]; To use Google Cloud Platform services, enter the location to the service account JSON file (not the JSON string itself). To use App Engine or Computer Engine, leave it blank. From Google's upgrading document:
Get $client = new PulkitJalan\Google\Client($config);
$googleClient = $client->getClient(); Laravel Example: $googleClient = Google::getClient(); Get a service $client = new PulkitJalan\Google\Client($config);
// returns instance of \Google\Service\Storage
$storage = $client->make('storage');
// list buckets example
$storage->buckets->listBuckets('project id');
// get object example
$storage->objects->get('bucket', 'object'); Laravel Example: // returns instance of \Google\Service\Storage
$storage = Google::make('storage');
// list buckets example
$storage->buckets->listBuckets('project id');
// get object example
$storage->objects->get('bucket', 'object'); Have a look at google/google-api-php-client-services to get a full list of the supported Google Services. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论