PHP code example of filippo-toso / api-sdk

1. Go to this page and download the library: Download filippo-toso/api-sdk 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 / api-sdk example snippets


use FilippoToso\Api\Sdk\Sdk;

class Windy extends Sdk
{
    public function list(): ListEndpoint
    {
        return new ListEndpoint($this);
    }
}


use FilippoToso\Api\Sdk\Endpoint;
use FilippoToso\Api\Sdk\Support\Response;

class ListEndpoint extends Endpoint
{
    public function nearby($latitude, $longitude, $radius = 10): Response
    {
        return $this->get('/list/nearby=' . $latitude . ',' . $longitude . ',' . $radius . '?' . http_build_query($this->params([
            'show' => 'webcams:location,image',
        ])));
    }
}

use FilippoToso\Api\Sdk\Support\Options;

ttps://api.windy.com/api/webcams/v2',
    'headers' => [
        'x-windy-key' => '...',
        'Content-Type' => 'application/json',
        'Accept' => 'application/json',
    ],
]);

$windy = new Windy($options);

$response = $windy->list()->nearby(45.9035644, 13.3038818, 10);

print_r($response->body());