Working on PHP API wrapper for hue lights

Working on PHP API wrapper for hue lights

TGDesigns

Member
Local time
08:51
Joined
Nov 20, 2019
Messages
89

Hi all, im attempting to create a wrapper for the hue api using php, I would love if any of you could read over what I have so far and give me some suggestions!

Im not completely sure im dealing with errors correctly and I know that my documentation is trash.

PHP:
$hueApi = new Hue("your hue bridge IP", "Your hue username");

if($hueApi->toggle_light("1")){
    print_r($hueApi->get_results());
}else{
    print_r($hueApi->get_errors());
}

if($hueApi->get_lights()){
    print_r($hueApi->get_results());
}else{
    print_r($hueApi->get_errors());
}

if($hueApi->get_new_lights()){
    print_r($hueApi->get_results());
}else{
    print_r($hueApi->get_errors());
}

if($hueApi->rename_light("1", "fifi_light")){
    print_r($hueApi->get_results());
}else{
    print_r($hueApi->get_errors());
}

if($hueApi->get_all_groups()){
    print_r($hueApi->get_results());
}else{
    print_r($hueApi->get_errors());
}

Thanks,
Tom

 
Last edited:
Top