PHP code example of mikespub / synology

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

    

mikespub / synology example snippets


$synology = new Synology\Api('192.168.10.5', 5000, 'http', 1);
//$synology->activateDebug();
$synology->connect('admin', 'xxxx');
print_r($synology->getAvailableApi());

$synology = new Synology\Applications\AudioStation('192.168.10.5', 5000, 'http', 1);
$synology->connect('admin', 'xxxx');
print_r($synology->getInfo());

use Synology\Applications\ClientFactory;

$synology = ClientFactory::getGeneric($service, '192.168.10.5', 5001, 'https');
$synology->connect('admin', '****');
// use generic client to call any api method
$result = $synology->call($api, $path, $method, $params, $version);

use Synology\Applications\ClientFactory;

$services = ClientFactory::getServices('192.168.10.5', 5001, 'https');
$services->connect('admin', '****');
// ...