two-faces / ivideon-php
IVideon
v1.0.1
2024-02-20 14:46 UTC
Requires
- php: >=8.0
- guzzlehttp/guzzle: ^7.8.1
- lazyjsonmapper/lazyjsonmapper: ^v2.0.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
This package is not auto-updated.
Last update: 2025-03-19 18:13:03 UTC
README
This is PHP Library which allow work with IVideon API
Instalation
composer require two-faces/ivideon-php
$account = new Account('login_email', 'password', '.cache'); $api = new Api($account, new WebFlow());
Please use .cache
file.
In first run library will try to login with your email and password and store your access_token
, userid
and userApiUrl
in cache file
all next runs will use these data.
If cacheFile
not set api will try login in every run (slowly)
Print all server and cameras
$servers = $api->servers->getServers(); foreach ($servers as $server) { echo $server->getTimezone(); // Important! see below foreach ($server->getCameras() as $camera) { echo $camera->getId() . PHP_EOL; } }
Create export request
/* Create export request * Please note that $start, $end is unix timestamp values * Please verify that $start, $end in your server timezone * * Important! * IVideon not allow to export "empty" videos, when nobody in all period * ExportRequestFailedException will be thrown */ $exportResult = $api->camera->exportMp4($cameraId, $start, $end); $exportId = $exportResult->getId();
Get all exports
$exports = $api->camera->getExports(); foreach ($exports as $export) { echo $export->getId() . ' = ' . $export->getStatus(); if ($export->getStatus() == \IVideon\Responses\ExportResult::EXPORT_STATUS_READY) { echo ' = ' . $export->getVideoUrl(); } echo PHP_EOL; };
Delete export file
$api->camera->deleteExport($exportId); // bool