PHP code example of cannonb4ll / laravel-philips-hue

1. Go to this page and download the library: Download cannonb4ll/laravel-philips-hue library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

cannonb4ll / laravel-philips-hue example snippets


(new HueClient)->lights()->on(1)

...

'philips-hue' => [
    'client_id' => env('PHILIPS_HUE_CLIENT_ID'),
    'client_secret' => env('PHILIPS_HUE_CLIENT_SECRET'),
    'app_id' => env('PHILIPS_HUE_APP_ID'),
    'device_id' => env('PHILIPS_HUE_DEVICE_ID'),
    'user' => env('PHILIPS_HUE_USERNAME')
]

...

'philips-hue' => [
    'client_id' => env('PHILIPS_HUE_CLIENT_ID'),
    'client_secret' => env('PHILIPS_HUE_CLIENT_SECRET'),
    'app_id' => env('PHILIPS_HUE_APP_ID'),
    'device_id' => env('PHILIPS_HUE_DEVICE_ID'),
    'user' => env('PHILIPS_HUE_USERNAME'),
    'routes' => false
]

    $hue = new HueClient();

    $hue->groups()->all();
    $hue->lights()->all();
    $hue->lights()->get(1);
    $hue->lights()->on(1);
    $hue->lights()->off(1);
    $hue->lights()->customState(1, [
        "hue" => 25500,
        "bri" =>200,
        "alert" => 'select'
    ]);