I am using Google app engine for my web app and I need to use a NoSQL database, so my best option is Google Cloud Datastore
Since I can't find a way to connect it with php I can't use it. In the official documentation php is not mentioned. I want to make sure that is there a way to access it with php ?
First, install the official Google Cloud Datastore PHP API using Composer (a dependency manager). You can do this by adding
"google/cloud-datastore": "^1.0"
to the 'require' section of your composer.json and runningcomposer update
You can start the local Datastore emulator with the command:
Here's a helper class I wrote that handles connecting to the datastore:
Here's how you would use it to insert a new entity into the datastore
If you run into issues with the emulator, try deploying your code to App Engine and seeing if you have the same error. The local development environment can be flaky.
Also, check out the official PHP Datastore API docs here.
Accessing Google Cloud Datastore from PHP is not documented, but you should be able to use Google APIs Client Library for PHP like any other Google APIs.
https://gae-php-tips.appspot.com/2013/12/24/getting-started-with-the-cloud-datastore-on-php-app-engine-part-ii/
A good starter primer for php access to datastore
This library may help people finding this thread
Designed to make Google Datatore easy from PHP.
https://github.com/tomwalder/php-gds
Include
google/cloud-datastore
library via composer$ composer require google/cloud-datastore
and you can use as Example below.
More details: https://github.com/GoogleCloudPlatform/google-cloud-php#google-cloud-datastore-ga