PHP code example of confidencesapp / oktave-sdk-php

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

    

confidencesapp / oktave-sdk-php example snippets


$config = [
    'client_id' => '{your_client_uuid}',
    'client_secret' => '{your_client_secret}',
    'webhook_secret' => '{your_webhook_secret}', // optional, 

$oktave = new Oktave\Client()
            ->setClientID('uuid')
            ->setClientSecret('ok_cltsec_...')
            ->setWebhookSecret('ok_whsec_...'); // optional, 

$config = [
    // ...
    'team_id' => '{your_team_uuid}' // optional, 

$oktave = new Oktave\Client($config)
            ->setTeamId('uuid'); // optional, 

// set the team to null.
$oktave = new Oktave\Client($config)
            ->setTeamId(null);

$oktave->setBaseURL('https://api.yourdomain.com');

// return a list of your blacklist items 
$oktave->blacklistItems->all();

// return a list of your paginated blacklist items
// items per page accepted values : 10, 20, 50, 100

$result = $oktave->blacklistItems->perPage(20)->page(5)->all();
$result->data() // contains the ressource collection
$result->meta() // contains the current pagination meta

/* [ 'current_page' => 5, 'per_page' => 20, 'total' => 95 ] */

$oktave->blacklistItems->get($blacklistItemID);

try {
    $oktave->blacklistItems->all();
} catch (Exception $e) {
    // do something with $e
}

// return true if the request signature is valid 
$oktave->webhooks->verifySignatureFromGlobals();


$eventID = isset($_SERVER['HTTP_OKTAVE_EVENT_ID']) ? $_SERVER['HTTP_OKTAVE_EVENT_ID'] : null;
$requestTimestamp = isset($_SERVER['HTTP_OKTAVE_TIMESTAMP']) ? (int) $_SERVER['HTTP_OKTAVE_TIMESTAMP'] : null;
$signature = isset($_SERVER['HTTP_OKTAVE_SIGNATURE']) ? $_SERVER['HTTP_OKTAVE_SIGNATURE'] : null;

// return true if the request signature is valid 
$oktave->webhooks->verifySignature($eventID, $requestTimestamp, $signature);