PHP code example of php-client / syncthing

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

    

php-client / syncthing example snippets


use PhpClient\Syncthing\Syncthing;

$syncthing = new Syncthing(
    baseUrl: 'http://127.0.0.1:8384',
    token: 'YOUR_API_TOKEN',
);

$response = $syncthing->api->config()->getAllDevices();

foreach ($response->json() as $device) {
    echo $device['name'];
}
bash
composer