Skip to content

Commit

Permalink
refactored code ( psr7, psr17 support)
Browse files Browse the repository at this point in the history
  • Loading branch information
Artem Stepin committed Jun 22, 2021
1 parent 7448a1b commit dc70b65
Show file tree
Hide file tree
Showing 17 changed files with 2,298 additions and 842 deletions.
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,35 @@ $ php composer.phar require cloudplaydev/confluence-php-client
<?php
declare(strict_types=1);

use CloudPlayDev\ConfluenceClient\Client;
use CloudPlayDev\ConfluenceClient\Curl;
use CloudPlayDev\ConfluenceClient\Entity\ConfluencePage;

//Create and configure a curl web client
$httpClient = new Curl('confluence_host_url','username','password');
// $curl = new CurlTokenAuth('confluence_host_url','NjU9OTXA4NDI2MRY5OkBznOUO8YjaUF7KoOruZRXhILJ9');
use CloudPlayDev\ConfluenceClient\ConfluenceClient;
use CloudPlayDev\ConfluenceClient\Entity\Content as ContentEntity;

//Create the Confluence Client
$client = new Client($httpClient);
$client = new ConfluenceClient('https://url-to-conluence');

//authenticate with a private access token
$client->authenticate('NjU2OTA4NDI2MTY5OkBznOUO8YjaUF7KoOruZRXhILJ9');

//Create a confluence page
$page = new ConfluencePage();
//Create a confluence content
$page = new ContentEntity();

//Configure your page
$page->setSpace('testSpaceKey')->setTitle('Test')->setContent('<p>test page</p>');
$page->setSpace('testSpaceKey')
->setTitle('Test')
->setContent('<p>test page</p>');

//Create the page in confluence in the test space
$client->createPage($page);
$client->content()->create($page);

//Get the page we created
$createdPage = $client->selectPageBy([
$createdPage = $client->content()->findOneBy([
'spaceKey' => 'testSpaceKey',
'title' => 'Test'
]);

//Update page content
$createdPage->setContent('some new content');
$client->updatePage($createdPage);
$client->content()->update($createdPage);



Expand Down
29 changes: 21 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "cloudplaydev/confluence-php-client",
"description": "Confluence API PHP Client",
"version": "0.0.2",
"version": "0.1.0",
"license": "MIT",
"keywords": [
"Atlassian",
Expand All @@ -11,10 +11,6 @@
"Client"
],
"authors": [
{
"name": "Yuxiao (Shawn) Tan",
"email": "[email protected]"
},
{
"name": "Artem Stepin",
"email": "[email protected]"
Expand All @@ -24,19 +20,36 @@
"autoload": {
"psr-4": {
"CloudPlayDev\\ConfluenceClient\\": [
"src/",
"src/"
]
}
},
"autoload-dev": {
"psr-4": {
"CloudPlayDev\\Tests\\ConfluenceClient\\": [
"tests/"
]
}
},
"require": {
"php": "^7.4",
"ext-curl": "*",
"ext-json": "*"
"ext-json": "*",
"psr/http-message": "^1.0",
"psr/http-client": "^1.0",
"psr/http-client-implementation": "^1.0",
"psr/http-factory": "^1.0",
"php-http/httplug": "^2.0",
"php-http/discovery": "^1.0",
"php-http/promise": "^1.0",
"php-http/client-common": "^2.0"
},
"require-dev": {
"roave/security-advisories": "dev-latest",
"phpunit/phpunit": "^9.5.5",
"phpstan/phpstan": "^0.12.90",
"vimeo/psalm": "^4.8"
"vimeo/psalm": "^4.8",
"guzzlehttp/guzzle": "^7.2",
"http-interop/http-factory-guzzle": "^1.0"
}
}
Loading

0 comments on commit dc70b65

Please sign in to comment.