PHP library to build highly customized reports using REST API.
Start Free TrialGroupDocs.Assembly Cloud SDK for PHP is a comprehensive, cloud‑based platform that enables developers to generate fully formatted documents—from simple letters to complex multi‑page reports—directly from PHP applications. The solution works entirely over HTTPS, so there is no need for any office software or heavyweight libraries on the client side; all heavy lifting is performed by GroupDocs Cloud services.
The SDK follows a clear three‑step workflow:
AssembleDocument
request, and receive the assembled document as a stream or a reference to a file stored in GroupDocs Cloud Storage.The SDK additionally offers powerful features such as conditional blocks, reusable variables, bar‑code generation, email attachment creation, and full HTML styling, making it possible to build dynamic, data‑driven documents that adapt to any business rule. All operations are secured with SSL/TLS and authenticated by access keys, ensuring that confidential data never leaves the encrypted channel.
Because the SDK is pure PHP and relies on standard REST calls, it runs on any operating system that supports PHP 5.6 + (including Windows, Linux and macOS) and integrates seamlessly with Composer, CI pipelines, or any custom deployment process.
The snippet below demonstrates the typical workflow for generating a document with the Assembly Cloud PHP SDK:
AssemblyApi
instance with your App SID and App Key.AssembleOptions
– specify template path, data, and output format.assembleDocument
and retrieve the assembled file.use GroupDocs\Assembly\AssemblyApi;
use GroupDocs\Assembly\Model;
use GroupDocs\Assembly\Requests;
$assemblyApi = new AssemblyApi('####################', '####################'); // replace with your credentials
$fileName = "Input1.docx"; // template file name
$dataFile = "Input2.docx"; // data source file (XML or DOCX)
// Upload template to Cloud Storage
$requestFileContent = $fileName;
$uploadDocumentRequest = new UploadFileRequest($requestFileContent, $fileName, NULL);
$assemblyApi->uploadFile($uploadDocumentRequest);
// Read data source
$reportData = file_get_contents($dataFile);
// Set assemble options
$assembleData = new Model\AssembleOptions([
"template_file_info" => new Model\TemplateFileInfo(["file_path" => $fileName]),
"save_format" => "docx",
"report_data" => $reportData
]);
$request = new Requests\AssembleDocumentRequest($assembleData);
$result = $assemblyApi->assembleDocument($request); // result contains the assembled document