PHP code example of szeidler / pageplanner-php-sdk
1. Go to this page and download the library: Download szeidler/pageplanner-php-sdk 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/ */
szeidler / pageplanner-php-sdk example snippets
use szeidler\Pageplanner\PageplannerClient;
$client = new PageplannerClient([
'baseUrl' => 'https://preportal.pageplanner.no/api-demo/api/',
'access_token_url' => 'https://login.microsoftonline.com/pageplannersolutions.com/oauth2/token',
'client_id' => 'xxxxxx-xxxxxxxxxxxx',
'client_secret' => '123456',
]);
// Get all issues.
$issues = $client->getIssues();
foreach ($issues->getIterator() as $issue) {
print $issue['name'];
}
// Get a issue by id.
$issue = $client->getIssue(['id' => 2]);
print $issue->offsetGet('name');
// Get all publications.
$publications = $client->getPublications();
foreach ($publications->getIterator() as $publication) {
print $publication['name'];
}
// Get a single publication by id.
$publications = $client->getPublications(['id' => 2]);
print $publication->offsetGet('name');
print $publication->offsetGet('publicationCode');
// Get all stories for an issue.
$stories = $client->getStories(['issueId' => 5]);
foreach ($stories->getIterator() as $story) {
print $story['name'];
}
// Get a single story by id.
$story = $client->getStory(['id' => 123]);
print $story->offsetGet('name');
print $story->offsetGet('author');
// Create a story for an issue.
$data = [
'id' => 'abcd',
'title' =>
[
'value' => 'My new title',
'isHtml' => FALSE,
],
'abstract' =>
[
'value' => 'Put your abstract here',
'isHtml' => FALSE,
],
'body' =>
[
'value' => '<strong>Your body could
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.