This code sample is intended to be in the following document: https://cloud.google.com/datastore/docs/datastore-api-tutorial
The code is using Google Cloud Client Library for PHP.
To run the sample, do the following first:
- Enable billing.
- Enable the Cloud Datastore API.
- Install dependencies via Composer.
Run
php composer.phar install(if composer is installed locally) orcomposer install(if composer is installed globally).
Then use one of the following methods:
- Run
gcloud auth application-default login
or
- Create a service account at the Service account section in the Cloud Console
- Download the json key file of the service account.
- Set GOOGLE_APPLICATION_CREDENTIALS environment variable pointing to that file.
Then you can run the command: php tasks.php
