Cloud REST API to quickly edit all popular document formats in any type of PHP application without installing any external software.
Start Free TrialGroupDocs.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.
Check out GroupDocs.Editor Cloud SDK for PHP at GitHub if you are looking for the source code to annotate file in the Cloud.
You can try GroupDocs.Editor Low-Code PHP APIs without any limitations.
GroupDocs.Editor Cloud is also available as Docker image which can be used to self-host the service. Or you may build your own services using GroupDocs.Editor High-code APIs which currently drive our REST APIs.
//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();