2017 © Pedro Peláez
 

project contentapi-sdk-php

Superdesk Content API SDK written in PHP

image

superdesk/contentapi-sdk-php

Superdesk Content API SDK written in PHP

  • Monday, January 18, 2016
  • by m038
  • Repository
  • 5 Watchers
  • 0 Stars
  • 43,100 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 5 Forks
  • 1 Open issues
  • 2 Versions
  • 14 % Grown

The README.md

Superdesk Content API PHP SDK

Build Status Scrutinizer Code Quality Code Climate SensioLabsInsight, (*1)

This is an SDK written in PHP for the Superdesk Content API., (*2)

For more information about the Superdesk Content API please read the documentation., (*3)

Installation

Requirements

  • PHP >= 5.3

When using the CurlApiClient and CurlClient classes make sure you've installed the following PHP extensions: * cURL * Multibyte String, (*4)

Composer

  • Require the SDK as a composer dependency
$ php composer.phar require superdesk/contentapi-sdk-php

Manual

  • Download a copy of the SDK
  • Add the classes to your autoloader

Customization

You can use your own client classes instead of CurlClient and CurlApiClient files. This is for example useful if your framework or project already has it's own http client, you can easily incorporate that without having multiple depencencies. All you need to do is to implement the ClientInterface and ClientApiInterface. For the ClientApi class there also a useful abstract class AbstractApiClient which contains some sane defaults., (*5)

Examples

This example uses the CurlClient and CurlApiClient files., (*6)

You can run the example.php via the cli with the command:, (*7)

$ php sample/default-client/example.php

Make sure you have the extenions cURL and Multibyte String enabled and you've installed the vendors., (*8)

$ php composer.phar install --no-dev

Samples

Authentication

OAuth username and password authentication. The CurlApiClient will automatically try to retrieve new access token if the previous token has been invalited., (*9)

setClientId(API_CLIENT_ID)
    ->setUsername(API_USERNAME)
    ->setPassword(API_PASSWORD);
$apiClient = new CurlApiClient($genericClient, $authentication);
$contentApi = new ContentApiSdk($apiClient, API_HOST, API_PORT, API_PROTOCOL);

?>

Pagination and traversing through results

We use Pagerfanta as a pagination library. All results returned from the methods getItems(...) and getPackages(...) are actually Pagerfanta instances. That should make it easy enough to traverse through your API results and also built in your own pagination., (*10)

getItems(array(), $startPage, $maxPerPage);

$items->getNbResults(); // Total items
$items->getMaxPerPage(); // Max results per age == $maxPerPage
$items->getNbPages(); // Total pages

?>

The Versions

18/01 2016

dev-master

9999999-dev

Superdesk Content API SDK written in PHP

  Sources   Download

GPL-3.0

The Requires

 

The Development Requires

by Mischa Gorinskat
by The Muppetshow

superdesk superdesk web publisher content api sdk superdesk content api superdesk sdk

26/08 2015

v0.1

0.1.0.0

Superdesk Content API SDK written in PHP

  Sources   Download

GPL-3.0

The Requires

  • php >=5.3

 

The Development Requires

by Mischa Gorinskat

superdesk superdesk web publisher content api sdk superdesk content api superdesk sdk