2017 © Pedro Peláez
 

library viewer-sdk-php

This repository contains GroupDocs.Viewer for Cloud SDK for PHP source code.

image

groupdocscloud/viewer-sdk-php

This repository contains GroupDocs.Viewer for Cloud SDK for PHP source code.

  • Tuesday, June 5, 2018
  • by groupdocscloud
  • Repository
  • 5 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 60 % Grown

The README.md

GroupDocs.Viewer Cloud SDK for PHP

This repository contains GroupDocs.Viewer Cloud SDK for PHP source code. This SDK allows you to work with GroupDocs.Viewer Cloud REST APIs in your PHP applications., (*1)

Dependencies

  • PHP 5.5 or later

Authorization

To use SDK you need AppSID and AppKey authorization keys. You can get your AppSID and AppKey at https://dashboard.groupdocs.cloud (free registration is required)., (*2)

Installation & Usage

Composer

The package is available at Packagist and it can be installed via Composer by executing following command:, (*3)

composer require groupdocscloud/groupdocs-viewer-cloud

Or you can install SDK via Composer directly from this repository, add the following to composer.json:, (*4)

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-php.git"
    }
  ],
  "require": {
    "groupdocscloud/groupdocs-viewer-cloud": "*"
  }
}

Then run composer install, (*5)

Manual Installation

Clone or download this repository, then run composer install in the root directory to install dependencies and include autoload.php into your code file:, (*6)

require_once('/path/to/groupdocs-viewer-cloud-php/vendor/autoload.php');

Tests

To run the unit tests set your AppSID and AppKey in json.config and execute following commands:, (*7)

php composer.phar install
./vendor/bin/phpunit

Getting Started

setAppSid("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX");
$configuration->setAppKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");

$viewApi = new GroupDocs\Viewer\ViewApi($configuration);

try {
    // Convert and download a document as JPG
    $format = "jpg";
    $filePath = "myfile.docx";
    $request = new GroupDocs\Viewer\Model\Requests\convertAndDownloadRequest($format, $filePath);
    $result = $viewApi->convertAndDownload($request);

    // Save the resulting file
    $outputPath = __DIR__ . "/output.jpg";
    file_put_contents($outputPath, $result->fread($result->getSize()));
    echo "File converted and saved to: " . $outputPath . "\n";
} catch (Exception $e) {
    echo "Something went wrong: ", $e->getMessage(), "\n";
}

?>

Below is an example demonstrating how to upload a document, render it, and download the result using GroupDocs.Viewer Cloud SDK for PHP., (*8)

setAppSid("XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX");
$configuration->setAppKey("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");

$fileApi = new GroupDocs\Viewer\FileApi($configuration);
$viewApi = new GroupDocs\Viewer\ViewApi($configuration);

try {
    // Upload a file to cloud storage
    $uploadRequest = new GroupDocs\Viewer\Model\Requests\uploadFileRequest("myfile.docx", __DIR__ . "/myfile.docx");
    $fileApi->uploadFile($uploadRequest);

    // Render it to HTML
    $viewOptions = new GroupDocs\Viewer\Model\ViewOptions();
    $fileInfo = new GroupDocs\Viewer\Model\FileInfo();
    $fileInfo->setFilePath("myfile.docx");
    $viewOptions->setFileInfo($fileInfo);
    $viewOptions->setViewFormat("HTML");
    $viewOptions->setOutputPath("myfile.html");

    $viewRequest = new GroupDocs\Viewer\Model\Requests\createViewRequest($viewOptions);
    $viewApi->createView($viewRequest);

    // Download the result
    $downloadRequest = new GroupDocs\Viewer\Model\Requests\downloadFileRequest("myfile.html");
    $result = $fileApi->downloadFile($downloadRequest);

    // Save the resulting file
    $outputPath = __DIR__ . "/myfile.html";
    file_put_contents($outputPath, $result->fread($result->getSize()));
    echo "Rendered file downloaded to: " . $outputPath . "\n";
} catch (Exception $e) {
    echo "Something went wrong: ", $e->getMessage(), "\n";
}

?>

Licensing

GroupDocs.Viewer Cloud SDK for PHP is licensed under MIT License., (*9)

Resources

Contact Us

Your feedback is very important to us. Please feel free to contact us using our Support Forums., (*10)

The Versions

05/06 2018

dev-master

9999999-dev https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-php

This repository contains GroupDocs.Viewer for Cloud SDK for PHP source code.

  Sources   Download

MIT

The Requires

 

The Development Requires

api php cloud sdk viewer groupdocs groupdocs cloud

05/06 2018

18.5

18.5.0.0 https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-php

This repository contains GroupDocs.Viewer for Cloud SDK for PHP source code.

  Sources   Download

MIT

The Requires

 

The Development Requires

api php cloud sdk viewer groupdocs

10/05 2018

18.2.1

18.2.1.0 https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-php

This repository contains GroupDocs.Viewer for Cloud SDK for PHP source code.

  Sources   Download

MIT

The Requires

 

The Development Requires

php viewer groupdocs groupdocs cloud

02/03 2018

18.2

18.2.0.0 https://github.com/groupdocs-viewer-cloud/groupdocs-viewer-cloud-php

This repository contains GroupDocs.Viewer for Cloud SDK for PHP source code.

  Sources   Download

MIT

The Requires

 

The Development Requires

php viewer groupdocs groupdocs cloud