Practical phpxlsx

Set-up, download and configuration

Introduction

phpxlsx is a software library designed to generate XLSX spreadsheets. It allows to create, update and modify Excel files, where you can add sheets, cell contents, tables, images, charts, links and so on, transform HTML/CSS content, change settings, transform to PDF and many other features.

The spreadsheet 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 methods and options for generating spreadsheets with phpxlsx, either using its basic functionality for creating spreadsheets, update existing files, converting HTML and CSS, or protecting your files with passwords, encrypting and signing them or converting to PDF.

Whether it is necessary to create a single spreadsheet or hundreds of thousands, phpxlsx is the perfect tool.

All phpxlsx paid licenses are open source, meaning that it is possible to modify the code of all classes. Software redistribution is not allowed.

Download

phpxlsx is a PHP code programmed proprietary product. There are three available licenses:

Basic

This license generates spreadsheets, works with templates, converts HTML and CSS and sets settings.

It allows to use the data library in a sub-domain, for example www.domain.com or docs.domain.com.

Advanced

In addition to the Basic license features, this version includes the Indexer class to get information from spreadsheets, the conversion plugin to convert XLSX to PDF, XLS and other multiple format files, 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

Premium

In addition of the Advanced license features, this version offers encryption and protection features, a stream mode to improve the performance, digital sign features, additional options to theme charts and other extra functionalities.

It allows to use the data library in an IP, and all the domains it serves, or a domain and all its subdomains.

Besides executing it in the subdomain/domain or IP address acquired, the three licenses allow you to execute phpxlsx in localhost (127.0.0.1) and private networks (classes A, B and C).

Set-up

phpxlsx set up is really simple. After purchasing the chosen license, download the ZIP package from the MY PHPXLSX page and copy the files to the server path where you will use the data/software library.

You can extract this package with any file compression tool or graphic application like 7-Zip, WinZip or WinRAR.

For Linux, execute the following command in a terminal:

Replacing phpxlsx.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
  • LICENSE: License file
  • Readme.txt: Version information and change log

To integrate phpxlsx with Composer please check the documentation available on Integrate phpxlsx with Composer projects.

Configuration

Each phpxlsx license is associated to a product key, which you need to add to the phpxlsxconfig.ini file in the config folder. A product key is not required for the Trial package.

The phpxlsxconfig.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:

Checking that everything works properly

Before including phpxlsx 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 CLI 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/Contents/addCell:

It generates an XLSX with a cell content.

Common issues

License error

phpxlsx 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 phpxlsx runs matches the purchased license.

Some specific file is missing

Not all files and directories included in phpxlsx are necessary to run the library, but a few of them are mandatory. The essential files for proper phpxlsx functioning are: classes and config, along with the files contained by these ones.

Permission issues

All necessary files of the previous point must have reading access rights for the user that executes the scripts.

Destination folder for generated XLSX files also must have read and write access for the user that generates the files.

Next - Creating a new spreadsheet