PHP code example of kan-agency / hive-php-api

1. Go to this page and download the library: Download kan-agency/hive-php-api 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/ */

    

kan-agency / hive-php-api example snippets

 bash
$ composer 
 php


namespace App;

use Kan\Hive\Device\Plug;
use Kan\Hive\Reference\Device

class Lamp extends Plug
{

    /**
     * {inheritdoc}
     */
    public function getDevice() : Device
    {
        return Device::make('123456ab-7898-7654-c321-d234567e89f1');
    }

}
 php

$hive->device('App\Lamp')->off(); // Will switch the lamp off.
$hive->device('App\Lamp')->on();  // Will switch the lamp on.