Set-up, download and configuration
phpdocx is a software library designed to generate dynamic DOCX documents. It allows to create, update and modify Word documents, where you can add texts, tables, images, graphic charts, sections and so on, import HTML/CSS content, transform to PDF and many other features.
The document generation tasks, as well as template working and conversion plugin features, are fully compatible with Linux, Windows and macOS operating systems, and also other PHP environments.
There are several, almost unlimited, options for generating documents with phpdocx, either using its basic functionality for creating documents, converting HTML and CSS, or protecting your files with passwords, encrypting and signing them, converting to PDF or merging them.
Whether it is necessary to create a single document or hundreds of thousands, phpdocx is the perfect tool.
All phpdocx paid licenses are open source, meaning that it is possible to modify the code of all classes. Software redistribution is not allowed.
phpdocx is a PHP code programmed proprietary product. There are three available licenses:
This version includes the basic features of the library: document generation, work with templates and HTML and CSS to DOCX conversion. Also, other useful utilities such as merging methods, watermark classes, the conversion plugin to convert DOCX to PDF, ODT and other multiple format files, DOCXPath features and other extra methods and classes.
You'll be able to use the data library in one domain and all its subdomains, for example www.domain.com and any other subdomain (*.domain.com) such as www.domain.com and docs.domain.com
In addition of the Advanced license features, this version offers HTML Extended and CSS Extended, stream mode, the encryption plugin, digital sign features, and other extra functionalities to optimize bulk and batch processing and get the best performance.
It allows to use the data library in an IP, and all the domains it serves, or a domain and all its subdomains.
phpdocx Bureau contains three Premium packages in one suite:
- phpdocx: Dynamic generation of DOCX documents.
MS Word documents.
- phpxlsx: Dynamic generation of XLSX spreadsheets.
MS Excel spreadsheets.
- phppptx: Dynamic generation of PPTX presentations.
MS PowerPoint presentations.
Besides executing it in the subdomain/domain or IP address acquired, the three licenses allow you to execute phpdocx in localhost (127.0.0.1) and private networks (classes A, B and C).
phpdocx set up is really simple. After purchasing the chosen license, download the ZIP package from the MY PHPDOCX page and copy the files to the server path where you will use the data/software library.
You can extract this package with any extract tool or a graphic application like 7-Zip, WinZip or WinRAR.
For Linux, execute the following command in a terminal:
Replacing phpdocx.zip with the downloaded package name.
After extracting the content of the package, you'll see the following files and directories:
- check.php: Dependencies and permissions checking file
- classes: Software library main classes
- config: Set up files
- examples: Set/group of included examples
- FaqsAndDocs.txt: Documentation links
- LICENSE: License file
- Readme.txt: Version information and change log
- templates: Base templates for document generation
- xsl: External XSL files for making MatML <=> OMML format conversions
To integrate phpdocx with Composer please check the documentation available on Integrate phpdocx with Composer projects.
Each phpdocx license is associated to a product key, which you need to add to the phpdocxconfig.ini file in the config folder. A product key is not required for the Trial package.
The phpdocxconfig.ini file contains the following information:
To start using the software library, it is required to add the license code and the purchased subdomain/domain/IP in the "license" section, for example:
Before including phpdocx in your own development, framework or CMS, it is recommendable to test the software library standalone. The check.php file is available for this purpose, it checks via web and text mode the dependencies and required access rights.
Also, it is advisable to execute one of the included examples using the PHP CLI mode.
For example, execute the sample_1.php example available in the path examples/Core/addText:
It generates a DOCX document with a short paragraph.
phpdocx only runs with the purchased license, localhost and private networks. If, when using the library, the 'There is not a valid license' exception appears, check that the URL where phpdocx runs matches the purchased license.
phpdocx uses the temporary path of the operating system to generate temporary files, which help to create the final DOCX document. The user that executes phpdocx, such as the Apache user or a system one, must have writing and reading access rights to the temporary directory.
Some hosting services don't allow to write in the temporary directory by default, and ISS has some issues running on the system temporary directories. Either this is your case or you prefer to choose a different route, the temp_path option in the phpdocxconfig.ini file allows to set a custom directory.
For example, to change the temporary directory to /home/web/temp, include the following line:
An important aspect to consider is that the path to this directory has to be absolute, not relative.
Some specific file is missing
Not all files and directories included in phpdocx are necessary to run the library, but a few of them are mandatory. The essential files for proper phpdocx functioning are: classes, config, lib, templates and xsl, along with the files contained by these ones.
All necessary files of the previous point must have reading access rights for the user that executes the scripts.
Destination folder for generated DOCX documents also must have read and write access for the user that generates the files.