PHP code example of slamby / slamby-sdk-php

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

    

slamby / slamby-sdk-php example snippets


    



use \Swagger\Client\Configuration;
use \Swagger\Client\ApiClient;
use \Swagger\Client\ApiException;
use \Swagger\Client\ObjectSerializer;
use \Swagger\Client\Api;
use \Swagger\Client\Model;

$config = new Configuration();
$config->setHost("http://<api_host>/");
$config->setSSLVerification(false);
$config->addDefaultHeader("Authorization", "Slamby <api_secret>");

$client = new ApiClient($config);

$dataSetManager = new Api\DataSetApi($client);
$dataSets = $dataSetManager->getDataSets();

$config->addDefaultHeader("X-DataSet", "<my_dataset>");

$tagManager = new Api\TagApi($client);
$tags = $tagManager->getTags();

$tag = new Model\Tag();
$tag["id"] = "123";
$tag["name"] = "New tag";

try {
    $tagManager->createTag($tag);
} catch (ApiException $e) {
    print($e->getResponseObject());
}

$documentManager = new Api\DocumentApi($client);
$document = $documentManager->getDocument("123456");

try {
    $document->language = "hu";
    $documentManager->updateDocument("123456", $document);
} catch (ApiException $e) {
    print($e->getResponseObject());
}

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/slamby/slamby-sdk-php.git"
    }
  ],
  "