aspose/words-sdk-php

This package is abandoned and no longer maintained. The author suggests using the aspose-cloud/aspose-words-cloud package instead.

Open, generate, edit, split, merge, compare and convert Word documents. Integrate Cloud API into your solutions to manipulate documents. Convert PDF to Word (DOC, DOCX, ODT, RTF and HTML) and in the opposite direction.


README

This repository contains Aspose.Words Cloud SDK for PHP source code. This SDK allows you to work with Aspose.Words Cloud REST APIs in your PHP applications quickly and easily, with zero initial cost.

Aspose.Words Cloud
API Reference

Key Features

  • Conversion between various document-related formats (20+ formats supported), including PDF<->Word conversion
  • Mail merge and reports generation
  • Splitting Word documents
  • Accessing Word document metadata and statistics
  • Find and replace
  • Watermarks and protection
  • Full read & write access to Document Object Model, including sections, paragraphs, text, images, tables, headers/footers and many others

Enhancements in Version 20.8

  • Added new api method (PUT '/words/{name}/compatibility/optimize') which is allows to optimize the document contents as well as default Aspose.Words behavior to a particular versions of MS Word
  • Added 'ApplyBaseDocumentHeadersAndFootersToAppendingDocuments' option to 'DocumentEntryList' for AppendDocument API
  • WithoutNodePath methods have been removed, pass null values instead

Enhancements in Version 20.7

  • Added 'Markdown' save format
  • Added endpoint to update paragraph format without node path (PUT '/words/{name}/paragraphs/{index}/format')

Enhancements in Version 20.6

  • Added new methods:
    • DeleteAllParagraphTabStopsWithoutNodePath
    • DeleteParagraphTabStopWithoutNodePath
    • GetParagraphTabStopsWithoutNodePath
    • InsertOrUpdateParagraphTabStopWithoutNodePath
    • InsertParagraphWithoutNodePath
    • UpdateParagraphFormatWithoutNodePath
    • UpdateParagraphListFormatWithoutNodePath
    • DeleteParagraphListFormatWithoutNodePath
  • DrawingObject related methods have been changed body content. Special request classes are introduced instead of strings.
  • InsertOrUpdateParagraphTabStop, DeleteParagraphTabStop methods have been changed parameter order
  • OoxmlSaveOptionsData.CompressionLevel property has been added

Enhancements in Version 20.5

  • Added methods to work with Word document lists
    • GetLists
    • GetList
    • InsertList
    • UpdateList
    • UpdateListLevel
  • Added methods to work with styles
    • GetStyles
    • UpdateStyle
    • InsertStyle
    • CopyStyle
    • GetStyleFromDocumentElement
    • ApplyStyleToDocumentElement
  • Added methods to work with paragraph list format
    • GetParagraphListFormat
    • GetParagraphListFormatWithoutNodePath
    • UpdateParagraphListFormat
    • DeleteParagraphListFormat
  • Added methods to work with paragraph tab stops
    • GetParagraphTabStops
    • InsertOrUpdateParagraphTabStop
    • DeleteAllParagraphTabStops
    • DeleteParagraphTabStop
  • Added methods to build reports
    • BuildReport
    • BuildReportOnline
  • Added Shading property to ParagraphFormat

How to use the SDK?

The complete source code is available in this repository folder. You can either directly use it in your project via source code or get Packagist distribution (recommended). For more details, please visit our documentation website.

Prerequisites

To use Aspose Words Cloud PHP SDK you need to register an account with Aspose Cloud and lookup/create App Key and SID at Cloud Dashboard. There is free quota available. For more details, see Aspose Cloud Pricing.

Installation

Via Composer:

aspose-words-cloud is available on Packagist as the aspose-words-cloud package. Run the following command:

composer require aspose-cloud/aspose-words-cloud

To use the SDK, use Composer's autoload:

require_once('vendor/autoload.php');

Sample usage

        // Start README example

        $api = new WordsApi($appSid, $appKey);
        // the step is optional, the default value is https://api.aspose.cloud
        $api->getConfig()->setHost($baseUrl);

        // upload file to cloud
        $upload_request = new Requests\UploadFileRequest($localFilePath, 'fileStoredInCloud.doc');
        $upload_result = $api->uploadFile($upload_request);

        // save as pdf file
        $saveOptions = new SaveOptionsData(array("save_format" => "pdf", "file_name" => 'destination.pdf'));
        $request = new Requests\SaveAsRequest('fileStoredInCloud.doc', $saveOptions);
        $result = $api->saveAs($request);

        // End README example

Tests contain various examples of using the SDK.

Dependencies

  • PHP 7.1 or later
  • referenced packages (see here for more details)

Comparison with Old generation SDK

New SDK has the following advantages over the previous version:

  • SDK is fully in sync with the API, all missing methods are added
  • Classes, methods and properties have comments and are IDE-friendly
  • Better security
  • Usage of Request/Response classes to represent long lists of parameters. This allows for cleaner code and easier backwards-compatibility going forward

New SDK is not backwards compatible with previous generation because of the last item. It should be straightforward to convert your code to using Request/Response objects, if you need any help on migration please ask at Free Support Forums.

Licensing

All Aspose.Words Cloud SDKs, helper scripts and templates are licensed under MIT License.

Contact Us

Your feedback is very important to us. Please feel free to contact us using our Support Forums.

Resources

Website
Product Home
API Reference
Documentation
Blog

Other languages

We generate our SDKs in different languages so you may check if yours is available in our list.

If you don't find your language in the list, feel free to request it from us, or use raw REST API requests as you can find it here.