renedekat / laravel-bigquery
2.0.1
2017-12-12 13:09 UTC
Requires
- php: ^7.0
- google/cloud: ^0.10.2|^0.11.0|^0.12.0|^0.13.0|^0.21.0|^0.22.0|^0.23.0|^0.24.0|^0.25.0|^0.26.0|^0.27.0|^0.28.0|^0.29.0|^0.30.0|^0.31.0|^0.32.0|^0.33.0|^0.34.0|^0.35.0
- illuminate/support: ~5.4.0|~5.5.0
- madewithlove/illuminate-psr-cache-bridge: ^1.0
Requires (Dev)
- mockery/mockery: ^0.9.5
- orchestra/testbench: ~3.4.6|~3.5.0
- phpunit/phpunit: ^6.1
This package is not auto-updated.
Last update: 2024-09-21 15:18:00 UTC
README
使用此包,您可以轻松地与 Google BigQuery API 交互。
安装
此包可以通过 Composer 安装。
$ composer require renedekat/laravel-bigquery
在 Laravel 5.5 中,此包将自动注册服务提供者。在 Laravel 5.4 中,您必须安装此服务提供者。
// config/app.php 'providers' => [ ... ReneDeKat\BigQuery\BigQueryServiceProvider::class, ... ];
在 Laravel 5.5 中,此包将自动注册外观。在 Laravel 5.4 中,您必须手动安装外观。
// config/app.php 'aliases' => [ ... 'BigQuery' => ReneDeKat\BigQuery\BigQueryFacade::class, ... ];
可选地,您可以使用以下命令发布此包的配置文件
php artisan vendor:publish --provider="ReneDeKat\BigQuery\BigQueryServiceProvider"
以下配置文件将发布到 config/bigquery.php
return [ /* |-------------------------------------------------------------------------- | Application Credentials |-------------------------------------------------------------------------- | | Path to the Service Account Credentials JSON File | | https://googlecloudplatform.github.io/google-cloud-php/#/docs/google-cloud/v0.35.0/guides/authentication | */ 'application_credentials' => env('GOOGLE_CLOUD_APPLICATION_CREDENTIALS'), /* |-------------------------------------------------------------------------- | Project ID |-------------------------------------------------------------------------- | | The Project Name is a user-friendly name, | while the Project ID is required by the Google Cloud client libraries to authenticate API requests. | */ 'project_id' => env('GOOGLE_CLOUD_PROJECT_ID'), /* |-------------------------------------------------------------------------- | Client Auth Cache Store |-------------------------------------------------------------------------- | | This option controls the auth cache connection that gets used. | | Supported: "apc", "array", "database", "file", "memcached", "redis" | */ 'auth_cache_store' => 'file', /* |-------------------------------------------------------------------------- | Client Options |-------------------------------------------------------------------------- | | Here you may configure additional parameters that | the underlying BigQueryClient will use. | | Optional parameters: "authCacheOptions", "authHttpHandler", "httpHandler", "retries", "scopes", "returnInt64AsObject" */ 'client_options' => [ 'retries' => 3, // Default ], ];
使用方法
此包仅初始化 BigQuery 连接,您可以使用 Google API 中的任何方法。您可以使用提供的 Facade 或从 IoC 容器中获取它。
BigQuery::apiMethod(); app('bigquery')->apiMethod();
以下有两个基本示例,用于创建数据集和检查表的存在性
创建数据集
$dataset = BigQuery::createDataset('myNewDataSet');
检查表的存在性
BigQuery::dataset(myNewDataSet)->table('aTable')->exists());
变更日志
请参阅 CHANGELOG 以获取有关最近更改的更多信息。
测试
$ vendor/bin/phpunit
贡献
请参阅 CONTRIBUTING 和 CONDUCT 以获取详细信息。
安全
如果您发现任何与安全相关的问题,请通过电子邮件 githubissues@schulze.co 而不是使用问题跟踪器。
致谢
许可
MIT 许可证 (MIT)。有关更多信息,请参阅 许可文件。