PHP code example of relaya / sdk-php

1. Go to this page and download the library: Download relaya/sdk-php 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/ */

    

relaya / sdk-php example snippets




use Relaya\RelayaApi;

RelayaApi::configure(accessToken: 'YOUR_ACCESS_TOKEN');
$result = RelayaApi::AccountApi()->getAccountModules();
print_r($result);



use Relaya\Api;

$result = Api::AccountApi()->getAccountModules();




 Configure API key authorization: ApiKeyAuth
$config = Relaya\Sdk\Configuration::getDefaultConfiguration()->setApiKey('X-Profile-Token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Relaya\Sdk\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Profile-Token', 'Bearer');


$apiInstance = new Relaya\Sdk\Api\AuthApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$profile_id = 7fa3c1d942be; // string | Идентификатор профиля Релая. Для новых профилей это 12-символьная hex-строка.
$integration = max; // string | Код интеграции профиля: например `max`, `vk`, `telegram`, `telegrambot`, `maxbot`, `whatsapp` или `email`.
$track_id = 'track_id_example'; // string | Параметр `trackId` из `query`.

try {
    $result = $apiInstance->getProfilesProfileIdIntegrationsIntegrationAuthQr($profile_id, $integration, $track_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AuthApi->getProfilesProfileIdIntegrationsIntegrationAuthQr: ', $e->getMessage(), PHP_EOL;
}

bash
composer 
bash
php artisan vendor:publish --tag=relaya-sdk-config