Report Generator for PHP

PHP library to build highly customized reports using REST API.

  • GroupDocs.Assembly Cloud SDK for cURL
  • GroupDocs.Assembly Cloud SDK for .NET
  • GroupDocs.Assembly Cloud SDK for Java
  • GroupDocs.Assembly Cloud SDK for Python
  • GroupDocs.Assembly Cloud SDK for Ruby
  • GroupDocs.Assembly Cloud SDK for Node.js
  • GroupDocs.Assembly Cloud SDK for Go
  • GroupDocs.Assembly Cloud SDK for Swift
  • GroupDocs.Assembly Cloud SDK for C++
Start Free Trial

GroupDocs.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:

  1. Prepare a template – a Word, Excel, PowerPoint or any supported file that contains placeholder fields and optional generation rules written in a LINQ‑style expression language.
  2. Create a data source – an XML or JSON file that holds the data to be merged into the template. The data can describe simple scalar values or complex collections that will be turned into tables, charts or repeated sections.
  3. Call the Assembly API – using the PHP SDK you upload the template (if it is not already stored), pass the template path, data source and desired output format to a single 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.

Document Assembly REST API Features

Cloud‑based document assembly accessed via REST API

Template engine with placeholder fields

LINQ‑style expression bindings for XML/JSON data

Embed images, charts, and external documents

Generate dynamic tables and lists from arrays

Insert hyperlinks and bookmarks programmatically

Apply formulas and sequential data operations

Conditional content blocks (IF‑ELSE logic)

Reusable variables for costly calculations

Generate barcodes directly in documents

Generate a document in PHP

The snippet below demonstrates the typical workflow for generating a document with the Assembly Cloud PHP SDK:

  1. Create an AssemblyApi instance with your App SID and App Key.
  2. Upload the template file to GroupDocs Cloud Storage.
  3. Load the data source (XML or DOCX).
  4. Configure AssembleOptions – specify template path, data, and output format.
  5. Call 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

Support and Learning Resources

GroupDocs.Assembly Cloud also offers SDKs for other languages:

  English
5f5c5ef