Issuu API client for PHP

v3.0.1 2024-05-14 14:40 UTC

This package is auto-updated.

Last update: 2024-05-14 14:49:16 UTC


README

Latest Version Latest build

Issuu - API client for PHP

Notes

The version 3.0 is for the Issuu API v2. Old API was deprecated on May 1st, 2024.

Installation

You can install this package via composer using this command:

composer require lasselehtinen/issuu

Supported functionality

Drafts

Endpoint Supported
List drafts Yes
Create a new Draft Yes
Delete a Draft by slug Yes
Update a Draft by slug Yes
Upload a document for a Draft by slug Yes
Publish a Draft by slug Yes

Publications

Endpoint Supported
List Publications Yes
Get Publication by slug Yes
Delete Publication by slug Yes
Get Publication assets by slug No
Get Publication Fullscreen share by slug No
Get Publication Reader Share URL by slug No
Get Publication QRCode share by slug No
Get Publication Embed code by slug No

Stacks

Endpoint Supported
List Stacks Yes
Create a new Stack Yes
Get Stack data by ID Yes
Delete a Stack by ID Yes
Update Stack data by ID No
Get Stack Items slug Yes
Add Stack Item by slug to stack Yes
Delete Stack Item by slug from stack No

Stats

Endpoint Supported
Get Stats No

User

Endpoint Supported
Get User Profile No
Get User Features No

Usage

Creating a client

First create a new instance with your API key and secret:

use lasselehtinen\Issuu\Issuu;

$issuu = new Issuu('apiKey');
$drafts = new Drafts($issuu);

$body = [
    'confirmCopyright' => true,
    'fileUrl' => 'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf',
    'info' => [
        'file' => 0,
        'access' => 'PUBLIC',
        'title' => 'Example title',
        'description' => 'Description',
        'preview' => false,
        'type' => 'editorial',
        'showDetectedLinks' => false,
        'downloadable' => false,
        'originalPublishDate' => '1970-01-01T00:00:00.000Z',
    ],
];

$createDraft = $drafts->create($body);

// Try few times until the file is converted
for ($i=0; $i < 10; $i++) {
    $draft = $drafts->getDraftBySlug($createDraft->slug);
    
    if ($draft->fileInfo->conversionStatus === 'DONE') {
        break;
    }

    sleep(2);
}

$publishDraftBySlug = $drafts->publishDraftBySlug($createDraft->slug, ['desiredName' => 'foobar']);

Contributing

Pull requests are welcome.

Pull Requests

  • Use PSR-2 Coding Standard.
  • Add tests! Your patch won't be accepted if it doesn't have tests.
  • Document any change in behaviour. Make sure the README.md and any other relevant documentation are kept up-to-date.
  • Send coherent history. Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting.

Running Tests

$ phpunit

Issues

If you have problems or suggestions, please open a new issue in GitHub.

License

The MIT License (MIT). Please see License File for more information.