Download the PHP package yii2tech/csv-grid without Composer

On this page you can find all versions of the php package yii2tech/csv-grid. 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 csv-grid

CSV Data Export extension for Yii2


This extension provides ability to export data to CSV file.

For license information check the LICENSE-file.

Latest Stable Version Total Downloads Build Status

Installation

The preferred way to install this extension is through composer.

Either run

or add

to the require section of your composer.json.

Usage

This extension provides ability to export data to CSV file. Export is performed via \yii2tech\csvgrid\CsvGrid instance, which provides interface similar to \yii\grid\GridView widget.

Example:

\yii2tech\csvgrid\CsvGrid allows exporting of the \yii\data\DataProviderInterface and \yii\db\QueryInterface instances. Export is performed via batches, which allows processing of the large data without memory overflow.

In case of \yii\data\DataProviderInterface usage, data will be split to batches using pagination mechanism. Thus you should setup pagination with page size in order to control batch size:

Note: if you disable pagination in your data provider - no batch processing will be performed.

In case of \yii\db\QueryInterface usage, CsvGrid will attempt to use batch() method, if it present in the query class (for example in case \yii\db\Query or \yii\db\ActiveQuery usage). If batch() method is not available - yii\data\ActiveDataProvider instance will be automatically created around given query. You can control batch size via \yii2tech\csvgrid\CsvGrid::$batchSize:

While running web application you can use \yii2tech\csvgrid\ExportResult::send() method to send a result file to the browser through download dialog:

Splitting result into several files

While exporting large amount of data, you may want to split export results into several files. This may come in handy in case you are planning to use result CSV files with program, which have a limit on maximum rows inside single file. For example: 'Open Office' and 'MS Excel 97-2003' allows maximum 65536 rows per CSV file, 'MS Excel 2007' - 1048576.

You may use \yii2tech\csvgrid\CsvGrid::$maxEntriesPerFile to restrict maximum rows in the single result file. In case the export result produce more then one CSV file - these files will be automatically archived into the single archive file. For example:

Note: you are not forced to receive multiple files result as a single archive. You can use \yii2tech\csvgrid\ExportResult::$csvFiles to manually iterate over created CSV files and process them as you like:

Archiving results

Export result is archived automatically, if it contains more then one CSV file. However, you may enforce archiving of the export result via \yii2tech\csvgrid\ExportResult::$forceArchive:

Heads up! By default \yii2tech\csvgrid\ExportResult uses PHP Zip extension for the archive creating. Thus it will fail, if this extension is not present in your environment.

You can setup your own archive method via \yii2tech\csvgrid\ExportResult::$archiver. For example:

While sending file to the browser via \yii2tech\csvgrid\ExportResult::send() there is no need to check if result is archived or not as correct file extension will be append automatically:

Customize output format

Although CSV dictates particular data format (each value quoted, values separated by comma, lines separated by line break), some cases require its changing. For example: you may need to separate values using semicolon, or may want to create TSV (tabular separated values) file instead CSV. You may customize format entries using \yii2tech\csvgrid\CsvGrid::$csvFileConfig:


All versions of csv-grid with dependencies

PHP Build Version
Package Version
Requires yiisoft/yii2 Version ~2.0.13
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 yii2tech/csv-grid contains the following files

Loading the files please wait ....