This simple command-line application demonstrates how to invoke Google IOT API from PHP. These samples are best seen in the context of the Official API Documentation.
- Enable APIs - Enable the IOT API and create a new project or select an existing project.
- Download The Credentials - Click "Go to credentials" after enabling the APIs. Click
"New Credentials"
and select "Service Account Key". Create a new service account, use the JSON key type, and
select "Create". Once downloaded, set the environment variable
GOOGLE_APPLICATION_CREDENTIALSto the path of the JSON key that was downloaded. - Clone the repo and cd into this directory
$ git clone https://github.com/GoogleCloudPlatform/php-docs-samples
$ cd php-docs-samples/iot
- Install dependencies via Composer.
Run
php composer.phar install(if composer is installed locally) orcomposer install(if composer is installed globally). - To run the IOT Samples, run any of the files in
src/on the CLI. Run them without arguments to print usage instructions:
$ php src/list_registries.php
Usage: list_registries.php $projectId [$location='us-central1']
@param string $projectId Google Cloud project ID
@param string $location (Optional) Google Cloud region
- See CONTRIBUTING.md
- See LICENSE
