PHP code example of tomcan / soundtouchapi

1. Go to this page and download the library: Download tomcan/soundtouchapi 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/ */

    

tomcan / soundtouchapi example snippets


// initialize the client
$client = new SoundTouchClient(array('ip' => 'ip-address-of-system'));

// set the volume to 42
$command = new SoundTouchVolumeSetCommand();
$command->setVolume(42);
$response = $client->send($command);

// read the volume from the unit
$command = new SoundTouchVolumeGetCommand();
$response = $client->send($command);

echo "The volume is set to " . $response->getActual();

# php composer.phar install