WebwinkelKeur API Client
This is a web client for the WebwinkelKeur API., (*1)
The documentation of the API is available at https://dashboard.webwinkelkeur.nl/pages/api., (*2)
Should you experience any issues with the API client, feel free to open a
GitHub issue., (*3)
Installation
You can use composer
to install the API client into your project:, (*4)
composer require webwinkelkeur/client
Usage
To send requests to the API, you need your WebwinkelKeur ID and authentication token., (*5)
use WebwinkelKeur\Client;
use WebwinkelKeur\Client\Request;
$webwinkelKeurClient = new Client($id, $authToken);
Sending invitations
$invitation = new Request\Invitation();
$invitation
->setCustomerName('John Doe')
->setEmailAddress('john.doe@example.com')
->setPhoneNumbers(['+1.2024561111', '+1.2024561414'])
->setOrderNumber(184553)
->setOrderTotal(23.55);
try {
$webwinkelKeurClient->sendInvitation($invitation);
echo 'Success!';
} catch (Client\Exception $e) {
echo $e->getMessage();
}
Retrieving sent invitations
try {
foreach ($webwinkelKeurClient->getSentInvitations() as $sentInvitation) {
echo 'Invitation for order ' . $sentInvitation->getOrderNumber()
. ' was sent on ' . $sentInvitation->getCreatedAt()->format('r')
. ' to ' . $sentInvitation->getEmail() . "\n";
}
} catch (Client\Exception $e) {
echo $e->getMessage();
}
Retrieving ratings
try {
foreach ($webwinkelKeurClient->getRatings() as $rating) {
echo $rating->getName() . ' says "' . $rating->getComment() . "\"\n";
}
} catch (Client\Exception $e) {
echo $e->getMessage();
}
Retrieving ratings summary
try {
$ratingsSummary = $webwinkelKeurClient->getRatingsSummary();
echo 'The average rating is ' . $ratingsSummary->getRatingAverage()
. ' out of ' . $ratingsSummary->getAmount() . " ratings.";
} catch (Client\Exception $e) {
echo $e->getMessage();
}
Retrieving web shop details
try {
$webshop = $webwinkelKeurClient->getWebshop();
$address = $webshop->getAddress();
echo $webshop->getName() . ' is located at '
. $address->getNumber() . ' ' . $address->getStreet() . ', ' . $address->getCity();
} catch (Client\Exception $e) {
echo $e->getMessage();
}
Retrieving rich snippet
try {
$richSnippet = $webwinkelKeurClient->getRichSnippet();
echo $richSnippet;
} catch (Client\Exception $e) {
echo $e->getMessage();
}