victor-stm/confluence
最新稳定版本:2.1.1
Composer 安装命令:
composer require victor-stm/confluence
包简介
Confluence API ADF helper
README 文档
README
Helps construct and publish documents into the Confluence using PHP.
Example
Set your secrets in the config part of ./example/demo-page.php and run script:
php example/demo-page.php
Usage
// config
$apiURL = 'domain.without.schema'; // Correct: 'x.atlassian.net', WRONG: 'https://x.atlassian.net'
$apiToken = 'user:api_token';
$pageID = '12378764';
$pageTitle = ''; // use page's title
$pageSpace = 'MY';
$confAPI = new Confluence ($apiURL, $apiToken);
//---------------------------------------------------------------------
// Content build
//---------------------------------------------------------------------
$content = new Content ();
//---------------------------------------------------------------------
// Headers
//---------------------------------------------------------------------
$h1 = new Header ('Header H1');
$h1->level = 1;
$h2 = new Header ('Header H2', 2);
$content->add ($h1)
->add ($h2)
->add (new Header ('Header H3, etc.', 3));
//---------------------------------------------------------------------
// Paragraph
//---------------------------------------------------------------------
$p = new Paragraph ('Hello, ');
$p->add (new Text('world!'))
->add (new Text(' And here is a link example: '))
->add (new TextWithLink('Google.com', 'https://google.com/'));
$content->add ($p);
//---------------------------------------------------------------------
// Table Node
//---------------------------------------------------------------------
$table = new Table ();
$table->attributes->layout = TableAttributes::LAYOUT_FULL_WIDTH;
//---------------------------------------------------------------------
// First row with header nodes
//---------------------------------------------------------------------
$headerRow = new TableRow ();
$table->add ($headerRow);
$headTime = new TableHeader ('Time');
$headTime->attributes->colwidth = [150];
$headProject = new TableHeader ('Project');
$headProject->attributes->colwidth = [220];
$headerRow->add ($headTime)
->add ($headProject)
->add (new TableHeader ('Message'));
//---------------------------------------------------------------------
// Rows
//---------------------------------------------------------------------
$table->add ((new TableRow())
->add (new TableCell ('00:00:00'))
->add (new TableCell ('Row 1 Project'))
->add (new TableCell ('Row 1 Message'))
);
// OR
$row = new TableRow();
$row->add (new TableCell ('00:00:00'));
$row->add (new TableCell ('Row 2 Project'));
$row->add (new TableCell ('Row 2 Message'));
$table->add ($row);
//---------------------------------------------------------------------
// Add table to content & update existing page
//---------------------------------------------------------------------
$content->add ($table);
$confAPI->updatePage ($pageID, $content, $pageTitle, $pageSpace);
Expected result:

License
Licensed under the MIT license.
统计信息
- 总下载量: 1.66k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-11-23