PHP code example of filippo-toso / wireguard-transport

1. Go to this page and download the library: Download filippo-toso/wireguard-transport 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/ */

    

filippo-toso / wireguard-transport example snippets


use FilippoToso\WireguardTransport\WireguardTransport;
use GuzzleHttp\Psr7\Request;

$client = WireguardTransport::withConfigFile(__DIR__ . '/wg0.conf');

$response = $client->sendRequest(new Request('GET', 'https://ifconfig.co/json'));

$address = json_decode((string) $response->getBody(), true)['ip'];

$client->disconnect();