PHP code example of aspose / words-sdk-php

1. Go to this page and download the library: Download aspose/words-sdk-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

aspose / words-sdk-php example snippets




        // Start README example

        $api = new WordsApi($clientId, $clientSecret);
        // 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 PdfSaveOptionsData(array("file_name" => 'destination.pdf'));
        $request = new Requests\SaveAsRequest('fileStoredInCloud.doc', $saveOptions);
        $result = $api->saveAs($request);

        // End README example