PHP code example of kanata-php / sdk-util

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

    

kanata-php / sdk-util example snippets


use KanataSdk\Sdk;
use KanataSdk\Request;
use KanataSdk\Response;

class ExampleSdk extends Sdk
{
    public function getResource(): Response
    {
        return $this->get(
            url: $this->options['api-url'] . '/api/resource',
        );
    }
}

$token = 'some-token-here';
$options = [
    'api-url' => 'https://some-url',
];
$exampleSdk = new ExampleSdk($token, $options);
$response = $exampleSdk->getResource();