Download the PHP package lekoala/spread-compat without Composer

On this page you can find all versions of the php package lekoala/spread-compat. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package spread-compat

Spread Compat

Easily manipulate PhpSpreadsheet, OpenSpout, League CSV and Baresheet

Why use this ?

Importing/exporting csv data is a very common task in web development. While it's a very efficient format, it's also somewhat difficult for end users that are used to Excel. This is why you often end up accepting also xlsx or ods format as a import/export target.

Ideally, importing single sheets of csv, excel or ods should be just a matter of changing an adapter. Thankfully, this package does just this :-)

Supported packages

Baresheet (Native): very fast csv, xlsx and ods import/export, but limited features. Can read/output streams. It is used as our default native adapter. https://github.com/lekoala/baresheet

OpenSpout: fast csv, excel (xlsx) and ods import/export https://github.com/openspout/openspout

League CSV: very fast csv import/export. Can read streams. https://github.com/thephpleague/csv

PhpSpreadsheet: slow excel (xls, xlsx) and ods and csv import/export, but more features https://github.com/PHPOffice/PhpSpreadsheet

SimpleXLSX: very fast excel import/export https://github.com/shuchkin/simplexlsx https://github.com/shuchkin/simplexlsxgen

This package will prioritize installed library, by order of performance. You can also pick your preferred default adapter for each format like this:

Using the facade

While you can use individual adapters, it's very likely you don't want to bother too much how your files are read and written. This package provides a simple facade with static methods in order to read and write files.

Please note that read methods return a Generator. If you want an array, you need to use iterator_to_array.

Output to browser

This package includes a simple way to leverage output to browser type of functionnality.

Some adapters allow you to stream directly the response.

Configure

Using named arguments

This package accepts options using ...opts, this means you can freely use named arguments or pass an array.

Using options object

You can also use the Options class that regroups all available options for all adapters. Unsupported options are ignored.

Setting the adapter

Instead of relying on the static variables, you can choose which adapter to use:

Security

CSV Formula Injection

When exporting to CSV, cell values starting with =, +, -, @, \t, or \r can be interpreted as formulas by spreadsheet software like Excel. This is known as CSV Formula Injection.

By default, this library does NOT escape these characters to ensure that the data is not altered and remains compatible with other tools that may expect raw data.

If you are generating CSV files for end users to open in Excel and want to protect them from potential formula injection, you should enable the escapeFormulas option:

This will prepend a single quote (') to any cell value that could be interpreted as a formula.

Worksheets

This package supports only 1 worksheet, as it is meant to be able to replace csv by xlsx or vice versa

Benchmarks

Since we can compare our solutions, there is a built in bench script. You can check the results here

For simple imports/exports, it's very clear that using the Native (Baresheet) adapter is the fastest overall choice.

Stop wasting cpu cycles right now and please use the most efficient adapter :-)


All versions of spread-compat with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1.2
ext-libxml Version *
ext-mbstring Version *
ext-simplexml Version *
ext-xmlreader Version *
ext-zip Version *
lekoala/baresheet Version ^0.2 || ^0.3 || ^0.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package lekoala/spread-compat contains the following files

Loading the files please wait ...