kvitli/confluence-rest-client

用于与Confluence REST API交互的库

0.0.1 2016-11-19 02:28 UTC

This package is not auto-updated.

Last update: 2024-09-23 07:14:10 UTC


README

用于与Confluence REST API交互的库

用法

使用Composer安装

composer require kvitli/confluence-rest-api

示例代码

# 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());

设置开发环境

git clone $repository
composer install

运行测试

php tests/tests.php

生成phpdoc

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