PHP code example of virtuallast / confluence-v2-php-client
1. Go to this page and download the library: Download virtuallast/confluence-v2-php-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/ */
virtuallast / confluence-v2-php-client example snippets
use VirtualLast\ConfluenceV2\Configuration;
use VirtualLast\ConfluenceV2\ConfluenceClient;
$client = ConfluenceClient::create(
new Configuration(
baseUrl: 'https://your-company.atlassian.net',
email: '[email protected]',
apiToken: $_ENV['CONFLUENCE_API_TOKEN'],
),
);
$page = $client->pages()->getPageById('123456');
echo $page->getTitle();
use VirtualLast\ConfluenceV2\Generated\Model\PagesPostBody;
use VirtualLast\ConfluenceV2\Generated\Model\PageBodyWrite;
$body = (new PageBodyWrite())
->setRepresentation('storage')
->setValue('<p>Hello from PHP</p>');
$request = (new PagesPostBody())
->setSpaceId('12345')
->setStatus('current')
->setTitle('Generated page')
->setBody($body);
$page = $client->pages()->createPage($request);