Giter Club home page Giter Club logo

php-data-exporter's Introduction

Data Export For PHP

Latest Version on Packagist Tests Total Downloads

Wrap sonata-project/exporter, make it easy and strong~

Feature

  • Simple api (use DataExporter::csv()->saveAs())
  • Quick change for different output type (csv/xlsx/xls/ods...)
  • Support a lot of source, and can use array or iterator quickly
  • Low memory usage with huge data write (use csv/xlsxSpout)
  • Low memory usage with chunk data fetch and write by chain (use GeneratorChainSourceIterator)
  • Support saveAs() and browserDownload()
  • Support do something in writing (use ObjectEvent)
  • Support control Spreadsheet and Spout Instance, for change style and others (use Extend)
  • Support Excel multi sheet write (use ExcelSheetSourceIterator)
  • Support Dynamic source (use CallableSourceIterator)

Installation

You can install the package via composer:

composer require kriss/data-export

Usage

simple Example

use \Kriss\DataExporter\DataExporter;

$source = [
    ['aaa', 'bbb', 'ccc'],
    ['aaa', 'bbb', 'ccc'],
    ['aaa', 'bbb', 'ccc'],
];
DataExporter::csv($source, ['showHeaders' => false])->saveAs();

Support Source

Support Writer

All Config in DataExporter::writerConfig(), see Tests

You can extend DataExporter and add Yours, see Example in Tests

FAQ

Why box/spout Use

box/spout can write xlsx use stream, but phpoffice/phpspreadsheet not. phpoffice/phpspreadsheet use lots of memory when write huge data, but box/spout use few!

When use GeneratorChainSourceIterator

When you should handle huge source and need to merge them in one write.

How to build style

Use extension, see ExtendSpoutTest or ExtendSpreadsheetTest

How to write multi sheet

Use ExcelSheetSpreadsheetTrait, see ExcelSheetSourceIteratorTest

php-data-exporter's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar krissss avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.