PHP code example of virtuallast / surfsight-php-client

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

    

virtuallast / surfsight-php-client example snippets


use VirtualLast\Surfsight\Configuration;
use VirtualLast\Surfsight\Region;
use VirtualLast\Surfsight\SurfsightClient;

$client = SurfsightClient::create(
    new Configuration(
        region: Region::Europe,
        email: $_ENV['SURFSIGHT_EMAIL'],
        password: $_ENV['SURFSIGHT_PASSWORD'],
    ),
);

$device = $client->devices()->getDeviceByImei($imei);
echo $device->getData()->getName();

$client = SurfsightClient::create(
    $configuration,
    $psr18Client,
    $psr17RequestFactory,
    $psr17StreamFactory,
);

$page = $client->events()->getEvents($imei, [
    'start' => '2026-07-01T00:00:00Z',
    'end' => '2026-07-02T00:00:00Z',
    'limit' => '100',
]);

foreach ($client->events()->iterateEvents($imei, [
    'start' => '2026-07-01T00:00:00Z',
    'end' => '2026-07-02T00:00:00Z',
    'limit' => '100',
]) as $event) {
    // $event is VirtualLast\Surfsight\Generated\Model\Event
}

$link = $client->media()->getEventFileLink($imei, [
    'fileId' => $fileId,
    'fileType' => 'video',
]);

$stream = $client->media()->download($link);

$ranges = $client->recordings()->getRecordingRanges($imei, [
    'start' => '2026-07-01T00:00:00Z',
    'end' => '2026-07-01T01:00:00Z',
]);
bash
composer