PHP code example of bloodlog / webinar-client

1. Go to this page and download the library: Download bloodlog/webinar-client 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/ */

    

bloodlog / webinar-client example snippets

 
'providers' => [
    Bloodlog\WebinarClient\Providers\WebinarClientProvider::class,
]

 'token' => 'Enter your api token', // 
 
 
use Bloodlog\WebinarClient\WebinarClient;

$client = new WebinarClient();

$webinars = $client->events()->webinarsRequest(); // получаем все вебинары

// Здесь нам нужно найти нужный вебинар и взять у него eventSessions -> id
// Или можно воспользоваться полезным запросом ниже
 
use Bloodlog\WebinarClient\WebinarClient;

$client = new WebinarClient();

$webinars = $client->events()->webinarsList(); // получаем только eventSessionId и имя вебинара
// Response:[
//     'id' => 123, // $eventSession->id,
//     'name' => 'Новый вебинар', // $eventSession->name,
//]
 
$client = new WebinarClient();
$eventSessionId = 123;
$webinars = $client->events()->eventSessions($eventSessionId);
/* Получаем список полей и сохраняем ключи полей. Ключи нужно использовать при регистрации пользователей.
Response:{
    "id": 123,
    "name": "Новое мероприятие сегодня",
    "additionalFields": [
        {
            "key": "cea75f8cd36a4f8567d5068b7e7e05e8",
            "label": "referrer",
            "type": "text",
            "isRequired": true
        }
    ],
}    
*/
 
$client = new WebinarClient();
$data = [
            'email' => '[email protected]',
            'name' => 'Иван',
            'secondName' => 'Иванов',
            'additionalFields' => [
                '62899cefc8855544723baae88cbfce9c' => 'Иванович',
                '62899cefc8855544723baae88cbfce2c' => 'IBM',
            ],
            'role' => 'GUEST',
            'isAutoEnter' => true,
            'sendEmail' => false,
];
$webinars = $client->registration()->registerRequest($eventSessionId, $data); 
// Response: {"participationId":123,"link":"https:\/\/events.webinar.ru\/Test\/9232275\/46a222712a0466960b1bf3a432c22054","contactId":654}

 'api' => [
        'registration' => [
            'form-transform' => [ // webinar.ru использует ключи вместо наименования полей. После получения ключей для регистрации нужно сопоставить поля
                'additionalFields' => [
                    '62899cefc8855544723baae88cbfce9c' => 'last_name', // Сопоставление по которому будет произведена замена
                    '62899cefc8855544723baae66cbfce2c' => 'company', // Сопоставление по которому будет произведена замена
                ],
            ],
        ],
    ],
 
 
$client = new WebinarClient();
$data = [
            'email' => '[email protected]',
            'name' => 'Иван',
            'secondName' => 'Иванов',
            'additionalFields' => [
                'last_name' => 'Иванович', // Замена на обратный ключ произойдёт внутри метода.
                'company' => 'IBM', // Замена
            ],
            'role' => 'GUEST',
            'isAutoEnter' => true,
            'sendEmail' => false,
];
$webinars = $client->registration()->registerRequest($eventSessionId, $data); 
// Response: {"participationId":123,"link":"https:\/\/events.webinar.ru\/Test\/9232275\/46a222712a0466960b1bf3a432c22054","contactId":654}

bash 
php artisan vendor:publish --provider="Bloodlog\WebinarClient\Providers\WebinarClientProvider"