2017 © Pedro Peláez
 

library plum-excel

image

plumphp/plum-excel

  • Sunday, October 25, 2015
  • by florianeckerstorfer
  • Repository
  • 1 Watchers
  • 3 Stars
  • 3,321 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 8 Versions
  • 3 % Grown

The README.md

Plum

PlumExcel includes readers and writers for Microsoft Excel files for Plum. Plum is a data processing pipeline for PHP., (*1)

Build Status Windows Build status Scrutinizer Code Quality Code Coverage StyleCI, (*2)

Developed by Florian Eckerstorfer in Vienna, Europe., (*3)

Features

  • Read Microsoft Excel (.xlsx and .xls) files
  • Write Microsoft Excel (.xlsx and .xls) files
  • Uses PHPExcel

Installation

You can install plum-excel using Composer., (*4)

$ composer require plumphp/plum-excel

Usage

PlumExcel contains a reader and a writer for Plum. Please refer to the Plum documentation for more information about Plum., (*5)

You can also find examples of how to use ExcelReader and ExcelWriter in the examples/ folder., (*6)

Write Excel files

Writing Excel files is extremely simply. Just pass the filename of the file to the constructor. If you want to add a header row call the autoDetectHeader() method., (*7)

use Plum\PlumExcel\ExcelWriter;

$writer = new ExcelWriter(__DIR__.'/example.xlsx');
$writer->autoDetectHeader();

You can manually set the header names by calling the setHeader() method and passing an array with names., (*8)

$writer->setHeader(['Country Name', 'ISO 3166-1-alpha-2 code']);

However, if you want more control, you can also pass an instance of PHPExcel to the constructor and the format (Excel2007 or Excel5) or an implementation of PHPExcel_Writer_IWriter., (*9)

$writer = new ExcelWriter(__DIR__.'/example.xlsx', $excel, 'Excel2007', $writer);

Read Excel files

Reading Excel files is also pretty simple., (*10)

use Plum\PlumExcel\ExcelReader;

$reader = new ExcelReader(__DIR__.'/example.xlsx');

Instead of a filename you can also pass an instance of PHPExcel to the constructor., (*11)

use Plum\PlumExcel\ExcelReader;

$excel = PHPExcel_IOFactory::load(__DIR__.'/example.xlsx');
$reader = new ExcelReader($excel);

Plum can automatically detect the headers by using Plum\Plum\Converter\HeaderConverter., (*12)

use Plum\Plum\Converter\HeaderConverter;
use Plum\Plum\Filter\SkipFirstFilter;
use Plum\PlumExcel\ExcelReader;

$workflow->addConverter(new HeaderConverter());
$workflow->addFilter(new SkipFirstFilter(1));
$workflow->process(new ExcelReader($filename));

Change Log

Version 0.3 (24 October 2015)

  • #2 Handle items that are not arrays

Version 0.2.1 (28 April 2015)

  • Fix Plum version

Version 0.2 (22 April 2015)

  • ExcelReader supports filename as input
  • Add support for Plum\Plum\Reader\ReaderFactory

Version 0.1 (21 April 2015)

  • Initial release

License

The MIT license applies to plumphp/plum-excel. For the full copyright and license information, please view the LICENSE file distributed with this source code., (*13)

The Versions

25/10 2015

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

The Development Requires

excel xls export xlsx import plum

24/10 2015

0.3.x-dev

0.3.9999999.9999999-dev

  Sources   Download

The Requires

 

The Development Requires

24/10 2015

v0.3

0.3.0.0

  Sources   Download

The Requires

 

The Development Requires

28/04 2015

0.2.x-dev

0.2.9999999.9999999-dev

  Sources   Download

The Requires

 

The Development Requires

28/04 2015

v0.2.1

0.2.1.0

  Sources   Download

The Requires

 

The Development Requires

22/04 2015

v0.2

0.2.0.0

  Sources   Download

The Requires

 

The Development Requires

21/04 2015

0.1.x-dev

0.1.9999999.9999999-dev

  Sources   Download

The Requires

 

The Development Requires

21/04 2015

v0.1

0.1.0.0

  Sources   Download

The Requires

 

The Development Requires