Issuu API client for PHP

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

This package is auto-updated.

Last update: 2024-11-14 16:07:40 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

Publications

Stacks

Stats

User

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.