PHP code example of php-client / tailscale

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


use PhpClient\Tailscale\Tailscale;

$tailscale = new Tailscale(
    token: 'YOUR_API_TOKEN',
);  

$response = $tailscale->api->devices()->listTailnetDevices(
    tailnet: '-', // Default tailnet
);

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