PHP code example of kvitli / confluence-rest-client

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

    

kvitli / confluence-rest-client example snippets


# Creating Confluence connection with parameters loaded from .env file
$cf = new Confluence();

# Get page id by space SPC and My sample page
$cf->get_page_id_by_title('SPC', 'My sample page');

# Update/create page My sample page in space SPC.
# $page_content must be valid XHTML
# $parent_page_id must be a page id
$cf->update_or_create_page('SPC', 'My sample page', $page_content, $parent_page_id);

$ Upload an attachment to a page
$cf->upload_attachment('/path/to/file', $page_id);

# Create a JIRA Link
$link = new Kvitli\Link('JIRA', $jira_key, $jira_key);

# Create an Info macro
$info = new Kvitli\Macro('info');

# Add a parameter
$info->add_parameter('atlassian-macro-output-type', 'INLINE');
# Add JIRA link to Macro as body
$info->set_body('<p>My JIRA LINK: '.$link->get_storage_format().'</p>');

# Create an Excerpt macro
$excerpt = new Kvitli\Macro('excerpt');
# Added Info macro to Excerpt macro
$excerpt->set_body($info->get_storage_format());


php tests/tests.php

php vendor/phpdocumentor/phpdocumentor/bin/phpdoc -d ./src -t ./docs/