I want to implement Google BigQuery API so I can execute query from my PHP code in BigQuery.
First I have installed the client library by following command:
Default credentials are provided by the Google APIs Client Library for PHP, versions 2.0.0 and newer. To use them, call useApplicationDefaultCredentials:
$client = new Google_Client();
$client->useApplicationDefaultCredentials();
Then, use the credentials to access an API service as follows:
$client->setScopes(['https://www.googleapis.com/auth/books']);
$service = new Google_Service_Books($client);
$results = $service->volumes->listVolumes('Henry David Thoreau');
I am suggesting checking out the link I gave it has much more options and we recommend using service accounts
.