1. Go to this page and download the library: Download omlet/smartcoop-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/ */
omlet / smartcoop-sdk example snippets
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();
$token = $_ENV['API_TOKEN'];
if (!$token) {
throw new Exception('token environment variable is not set.');
}
$omlet = \Omlet\SmartCoop\Omlet::create($token);
$devices = $omlet->getDevices();
foreach ($devices as $device) {
// a list of your devices
}
// a single device
$device = $omlet->getDeviceById('123456');
$group = $omlet->createGroup("New Group name");
$groups = $omlet->getGroups();
foreach ($groups as $$group) {
// a list of your groups
}
// a single group
$group = $omlet->getGroupById('groupID')
// invite a user with User access
$groupHandler->inviteUser("[email protected]", Acccess::USER);
// invite a user with Admin access
$groupHandler->inviteUser("[email protected]", Acccess::ADMIN);
$invites = $userHandler->getData()->getInvites();
// invites is an array containing GroupSubset objects. Pass one of these
// to acceptInvite
$userHandler->acceptInvite($groupSubset);
$invites = $userHandler->getData()->getInvites();
// invites is an array containing GroupSubset objects. Pass one of these
// to rejectInvite
$userHandler->rejectInvite($groupSubset);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.