dev-master
9999999-devPHP Nest API client
MIT
The Requires
- php >=7.1
- werkspot/enum ^2.1
The Development Requires
PHP Nest API client
This package provides a simple integration of the Official Nest Api for your PHP project., (*1)
With composer, add:, (*3)
$ composer require laulamanapps/nest-api
if you want to make use of the provided Guzzle adapter, require guzzlehttp in your composer:, (*4)
$ composer require guzzlehttp/guzzle
Sign up at Nest as a Developer and get yourself an ClientID
and ClientSecret
, (*5)
Run the get-oauth-token
in the terminal and follow the instructions, (*6)
$ ./bin/get-oauth-token
use LauLamanApps\NestApi\NestClientFactory; use LauLamanApps\NestApi\Client\Device\Thermostat\Temperature; $client = NestClientFactory::create('<AccessToken>'); $thermostat = $client->getThermostat('<DeviceId>'); // Get current Temperature echo 'The current temperature is:'; echo $thermostat->getAmbientTemperature(); // Set Target Temperature $newTemperature = Temperature::celsius(21.5); $thermostat->setTargetTemperature($newTemperature);
This package comes with 2 types of tests: Unit and Integration. To run them you can use the make commands in the projects root., (*7)
$ make tests # Runs all tests $ make tests-unit # Runs only unit tests $ make tests-integration # Runs only integration tests
Nest API has been developed by LauLaman., (*8)
PHP Nest API client
MIT