PHP code example of indiana-university / iukb-api-doc-content-php

1. Go to this page and download the library: Download indiana-university/iukb-api-doc-content-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/ */

    

indiana-university / iukb-api-doc-content-php example snippets


use Edu\Iu\Uits\KnowledgeBase\Document\ContentFactory;

$doc = $kb->getDocument('amyk');
$content = ContentFactory::create($doc->getContent());
echo $content->getBody();

use Edu\Iu\Uits\KnowledgeBase\Document\ContentFactory;

$doc = $kb->getDocument('amyk');
$content = ContentFactory::create($doc->getContent());

// If the hrefs are simply the doc id but need to be /help/docid
$content->rebaseKbLinks('', '/help/');

// If the links are full urls to the KB but need to be /help/docid
$content->rebaseKbLinks('https://kb.iu.edu/d/', '/help/');

use Edu\Iu\Uits\KnowledgeBase\Document\ContentFactory;

$doc = $kb->getDocument('amyk');
$content = ContentFactory::create($doc->getContent());
$content->rivetize();