1. Go to this page and download the library: Download novoxpro/restopulse-php-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/ */
novoxpro / restopulse-php-sdk example snippets
use Restopulse\PhpSdk\Client\Client;
use Restopulse\PhpSdk\Configuration\Configuration;
use Restopulse\PhpSdk\DTO\Request\EventDto;
use Restopulse\PhpSdk\DTO\Request\EventFieldDto;
$config = new Configuration(apiKey: 'ваш-api-key');
$client = new Client($config);
// Получение филиалов
$branches = $client->branches()->all();
// Отправка события
$event = new EventDto(
branchIds: [47],
eventType: 'order.created',
externalId: 'ORD-100500',
eventDate: new DateTimeImmutable('now'),
title: 'Новый заказ',
preview: 'Заказ оформлен на сайте',
message: 'Создан заказ №100500.',
fields: [new EventFieldDto('Номер заказа', '100500')],
);
$eventId = $client->events()->send($event)->getId();