A simple app to make calls to the Datastore API
-
Go to Google Developers Console and create a new project. This will automatically enable an App Engine application with the same ID as the project.
-
Enable the "Google Cloud Datastore API" under "APIs & auth > APIs."
-
edit
app.yamland changeYOUR_GCP_PROJECT_IDto your App Engine project ID -
For local development also follow the instructions below.
-
Go to "Credentials" and create a new Service Account.
-
Select "Generate new JSON key", then download a new JSON file.
-
Set the following environment variables:
GOOGLE_APPLICATION_CREDENTIALS: the file path to the downloaded JSON file.GCP_PROJECT_ID: Your app engine project ID
-
- Install
composer - Install Google API client library for PHP by running:
composer installyou can run locally using PHP's built-in web server:
cd php-docs-samples/datastore
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json
export GCP_PROJECT_ID=my-project-id
php -S localhost:8080 -t web/Now you can view the app running at http://localhost:8080 in your browser.
Prerequisites
- Install the App Engine PHP SDK. We recommend you install Cloud SDK rather than just installing App Engine SDK.
Deploy with gcloud
$ gcloud preview app deploy app.yaml --set-default --project YOUR_GCP_PROJECT_ID
Then access the following URL: https://{YOUR_GCP_PROJECT_ID}.appspot.com/
$ dev_appserver.py -A your-project-id .
- See CONTRIBUTING.md
- See LICENSE
