Documents Editor REST API & PHP Cloud SDK

Cloud REST API to quickly edit all popular document formats in any type of PHP application without installing any external software.

Start Free Trial
GroupDocs.Editor Cloud SDK for PHP

GroupDocs.Editor Cloud SDK for PHP

 
 

GroupDocs.Editor Cloud SDK for PHP supports editing and manipulating a bunch of popular document file formats within PHP applications. Simply integrate GroupDocs.Editor Cloud SDK for PHP with GroupDocs.Editor Cloud REST API, upload supported document in any third-party WYSIWYG HTML editor, manipulate the document and save it back to the original document format without disturbing the appearance after editing. The PHP editor library supports a variety of document formats including Microsoft Word (DOC, DOCX, WordML), Excel (XLS, XLSX, SpreadsheetML), Presentations (PPT, PPTX), HTML, XML, TXT and OpenDocument.

GroupDocs.Editor Cloud SDK for PHP is built as a layer on top of GroupDocs.Editor Cloud REST API that saves valuable development time by managing low-level requests and handling responses. The developers can focus on writing up the specific code only as needed in the project.

Previous Next
 

Advanced Document Editor REST API Features

 

 

Integrates easily within any WYSIWYG editor

 

Edit Word documents as a whole or define pages range

 

Multi-tabbed spreadsheet editing is supported

 

Optimized memory usage for large CSV or TSV files

 

Extract document information (type, size, page count etc)

 

Cloud REST API to be used with any language or platform

Working with WordProcessing Documents - PHP


//Get your App SID, App Key and Storage Name at https://dashboard.groupdocs.cloud (free registration is required).
$AppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
$AppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
  
$configuration = new GroupDocs\Editor\Configuration();
$configuration->setAppSid($AppSid);
$configuration->setAppKey($AppKey);
 
$editApi = new GroupDocs\Editor\EditApi($configuration);
$fileApi = new GroupDocs\Editor\FileApi($configuration);
 
// The document already uploaded into the storage
// Load it into editable state
$fileInfo = new Model\FileInfo();
$fileInfo->setFilePath("Spreadsheet/four-sheets.xlsx");        
$loadOptions = new Model\SpreadsheetLoadOptions();
$loadOptions->setFileInfo($fileInfo);
$loadOptions->setOutputPath("output");
$loadOptions->setWorksheetIndex(0);
$loadResult = $editApi->load(new Requests\loadRequest($loadOptions));
 
// Download html document
$htmlFile = $fileApi->downloadFile(new Requests\downloadFileRequest($loadResult->getHtmlPath()));
$html = file_get_contents($htmlFile->getRealPath());
 
// Edit something...
$html = str_replace("This is sample sheet", "This is sample sheep", $html);
 
// Upload html back to storage
file_put_contents($htmlFile->getRealPath(), $html);
$uploadRequest = new Requests\uploadFileRequest($loadResult->getHtmlPath(), $htmlFile->getRealPath());
$fileApi->uploadFile($uploadRequest);
 
// Save html back to xlsx
$saveOptions = new Model\SpreadsheetSaveOptions();
$saveOptions->setFileInfo($fileInfo);
$saveOptions->setOutputPath("output/edited.xlsx");
$saveOptions->setHtmlPath($loadResult->getHtmlPath());
$saveOptions->setResourcesPath($loadResult->getResourcesPath());
$saveResult = $editApi->save(new Requests\saveRequest($saveOptions));
 
// Done.
echo "Document edited: " . $saveResult->getPath();
 

Support and Learning Resources