1. Go to this page and download the library: Download ricasolucoes/atlassian 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/ */
ricasolucoes / atlassian example snippets
use Atlassian\Question\QuestionService;
$qs = new QuestionService(new \Atlassian\Configuration\ArrayConfiguration(
[
'host' => 'https://your-confluence.host.com',
'user' => 'confluence-username',
'password' => 'confluence-password',
]
));
use Atlassian\Configuration\ArrayConfiguration;
use Atlassian\Issue\IssueService;
$iss = new IssueService(new ArrayConfiguration(
array(
'jiraHost' => 'https://your-jira.host.com',
// for basic authorization:
'jiraUser' => 'jira-username',
'jiraPassword' => 'jira-password-OR-api-token',
// to enable session cookie authorization (with basic authorization only)
'cookieAuthEnabled' => true,
'cookieFile' => storage_path('jira-cookie.txt'),
// if you are behind a proxy, add proxy settings
"proxyServer" => 'your-proxy-server',
"proxyPort" => 'proxy-port',
"proxyUser" => 'proxy-username',
"proxyPassword" => 'proxy-password',
)
));
use Atlassian/Client;
use Atlassian/Curl;
use Atlassian/Entity/ConfluencePage;
//Create and configure a curl web client
$curl = new Curl('confluence_host_url,'username','password');
//Create the Confluence Client
$client = new Client($curl);
//Create a confluence page
$page = new ConfluencePage();
//Configure your page
$page->setSpace('testSpaceKey')->setTitle('Test')->setContent('<p>test page</p>');
//Create the page in confluence in the test space
$client->createPage($page);
//Get the page we created
echo $client->selectPageBy([
'spaceKey' => 'testSpaceKey',
'title' => 'Test'
]);