-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.php
42 lines (37 loc) · 1.08 KB
/
example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
use BestBrands\KiyohClient\Client;
use BestBrands\KiyohClient\Exceptions\KiyohException;
use BestBrands\KiyohClient\Models\Invitee;
require "vendor/autoload.php";
$client = new Client(...);
$location_id = ...;
/**
* Send an invite to a client
*/
try {
if ($client->invite((new Invitee())
->setInviteEmail('harm@bestbrands.eu')
->setDelay(1)
->setFirstName('Harm')
->setLastName('Smits')
->setLocationId($location_id)
->setRefCode(...)
)->getCode() === 'A') {
echo 'Invite is scheduled';
} else {
echo 'Invite is not scheduled';
}
} catch (KiyohException $exception) {
echo 'Invite is not scheduled';
}
/**
* Iterate over the reviews
*/
($date = new DateTime())->setDate(2020, 01, 01);
foreach ($client->getReviews($location_id, $date)->getReviews() as $review)
echo "Review written by: " . $review->getReviewAuthor() . "\n";
/**
* Get location statistics
*/
$stats = $client->getLocationStatistics($location_id);
echo "Average rating of last 12 months: " . $stats->getLast12MonthAverageRating() . "\n";