Wednesday, September 18, 2024
HomePHPLight-weight Spreadsheets for Laravel - Laravel Information

Light-weight Spreadsheets for Laravel – Laravel Information


If you happen to’re on the lookout for a light-weight bundle that may learn and write spreadsheets, Chris Morrell‘s Linen bundle is a light-weight spreadsheet bundle for Laravel. This bundle is a wrapper for the openspout/openspout bundle which helps you to learn and write spreadsheets in a quick and scalable manner.

Listed below are a number of examples of how you need to use the Linen bundle to learn and write spreadsheets:

use GlhdLinenCsvReader;

use GlhdLinenExcelReader;

 

$information = [

['user_id' => 1, 'name' => 'Chris', 'nullable' => null, 'number' => 40.2],

['user_id' => 10, 'name' => 'Bogdan', 'nullable' => 'not null', 'number' => -37],

];

 

// CSV

$assortment = CsvReader::from('primary.csv')->gather();

$tempfile = CsvWriter::for($information)->writeToTemporaryFile();

 

// Excel

$assortment = ExcelReader::from('primary.xlsx')->gather();

$tempfile = ExcelWriter::for($information)->writeToTemporaryFile();

Linen offers some conveniences on high of the Openspout bundle, resembling utilizing Laravel’s LazyCollection class when studying spreadsheets. You may get began with this bundle by putting in it by way of composer:

composer require glhd/linen

The readme and supply code is obtainable on GitHub at glhd/linen.



RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments