Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
This package has been abandoned.
Generated on Mar 19, 2024 via composer

box/spout v2.7.3

PHP Library to read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way
Package summary
Share
1
issue
1
high severity
meta
1
1
license
1
Apache-2.0
Package created
16 Jan 2015
Version published
25 Sep 2017
Maintainers
1
Total deps
1
Direct deps
0
License
Apache-2.0

Issues

1

1 high severity issue

high
via: box/spout@v2.7.3
Collapse
Expand

Licenses

Apache License 2.0

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
use-patent-claims
place-warranty
Cannot
hold-liable
use-trademark
Must
include-copyright
include-license
state-changes
include-notice
1 Packages, Including:
box/spout@v2.7.3
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
ⓘ This is a list of box/spout 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does box/spout do?

Box/Spout is a highly efficient PHP library designed for reading and writing spreadsheet files. It's capable of handling all commonly used formats, including CSV, XLSX, and ODS. The feature that sets it apart is its performance with large files — it can process these while maintaining minimal memory usage, which is under 3MB. It's brilliant for those looking to work with large-scale data and manage spreadsheets in a quick, memory-friendly manner.

How do you use box/spout?

To use Box/Spout in your PHP projects, the first step is installing the package, which you can do via composer with the command composer require box/spout. After installation, the library can be included in your script with the help of autoloading.

To read files, you can utilize the ReaderFactory which provides methods to create a reader object according to your file type. Then, by using the open method of this reader object, you can access rows of the spreadsheet.

<?php

use Box\Spout\Reader\Common\Creator\ReaderEntityFactory;

$reader = ReaderEntityFactory::createReaderFromFile('/path/to/your/file.csv');
$reader->open();

foreach ($reader->getSheetIterator() as $sheet) {
    foreach ($sheet->getRowIterator() as $row) {
        $cells = $row->getCells();
        // process cells
    }
}

$reader->close();

When it comes to writing data, the WriterFactory is your best tool. It provides methods to create a writer object suitable for your preferred file type. Use the addRow function of this writer object to write data into files.

<?php

use Box\Spout\Writer\Common\Creator\WriterEntityFactory;
use Box\Spout\Common\Entity\Row;

$writer = WriterEntityFactory::createCSVWriter();
$writer->openToFile('/path/to/your/file.csv');

$data = ['data1', 'data2', 'data3']; // data to write
$row = WriterEntityFactory::createRowFromArray($data);
$writer->addRow($row);

$writer->close();

Where are the box/spout docs?

You can find complete instructions, explanations, and examples for each function in the Box/Spout documentation. The docs are found at the following URL: https://opensource.box.com/spout/. It's crucial to refer to these to fully understand how each component of this library works and to determine the best ways to use it in your PHP projects.