Download the PHP package inwebo/csv without Composer

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

PHP CSV Reader & Writer

GitHub Actions Workflow Status Packagist Version Packagist Downloads Packagist License PHP Version PHPStan Level

This library provides two classes — Inwebo\Csv\Reader and Inwebo\Csv\Writer — for reading and writing CSV files with a low memory footprint. Both extend PHP's SplFileObject, making all native file handling methods (like setCsvControl) available on each instance.

See the PHP documentation for SplFileObject for more details.


Key Features


Installation

Tests

PhpStan

Level 10

Usage

Basic Reading

To get started, simply instantiate the Reader class with the path to your CSV file. By default, it assumes the first row contains column names, and data starts at index 1.

Disabling Column Names

If your CSV file does not have a header row, you can disable the column name mapping by setting the hasHeaders parameter to false. In this case, indices start at 0.


Manual Column Mapping

For files without a header, you can manually define column names using the setHeader() method. This allows you to treat the data as an associative array even without a header row. Indices start at 0.


Advanced Usage: Normalizers and Filters

You can add multiple normalizers and filters to your Reader instance. They are executed sequentially in the order they are added (FIFO).

Normalizers

Normalizers are used to modify the data. The callback receives the line array by reference, allowing you to directly alter its values. They are executed sequentially in the order they are added (FIFO).

Filters

Filters are used to validate and exclude entire rows. If a filter returns false, the line will be skipped and will not be yielded by the generator.

With both normalizers and filters in place, the processing loop becomes a clean, declarative statement of what you want to achieve.

Reading a Specific Range

You can also read a specific range of rows using the rows() method with from and to parameters. Both parameters must be provided together or both omitted.

[!IMPORTANT] When hasHeaders is true (default), the first data row is at index 1. When false, it starts at 0.

Reading a Specific Row

The rowAt() method allows you to retrieve a specific row by its index. If the row contains missing columns compared to the header, they will be returned as null.


Writer

Basic Writing

Instantiate Writer with the path to the output file. The default mode is 'w' (truncate or create). Use 'a' to append to an existing file.

All configuration methods return static for fluent chaining:

Writing Multiple Rows

rows() accepts any iterable — arrays or Generator objects:

Excel Compatibility

Enable the UTF-8 BOM to ensure correct character encoding when opening the file in Excel on Windows. Use \r\n as the line ending for RFC 4180 compliance.

The BOM is written automatically before the first row (header or data).

Custom Delimiter

CSV control (delimiter, enclosure, escape) is delegated to the inherited setCsvControl() method:


Filters and Normalizers

Filters and normalizers on the Writer follow the same FIFO pipeline as on the Reader. For each row, filters run first — if any returns false the row is skipped entirely — then normalizers transform the data before it is written.

Filters and normalizers do not apply to the header row written by setHeader().

Validating column count

A common use case is rejecting malformed rows whose column count does not match the header before writing them:

Normalizing data before writing

Normalizers receive the row array by reference, allowing direct modification:

Combining filters and normalizers

Filters and normalizers can be combined freely. The pipeline order is always: filter → normalize → write.


ETL: Reader to Writer

Because Writer::rows() accepts any iterable, you can pipe Reader::rows() directly into it without buffering the entire file in memory:

Filters and normalizers applied to the Reader are evaluated lazily during iteration, so the pipeline processes one row at a time regardless of file size.


Realistic Scenario: Customer Migration

This scenario reads a legacy customer CSV (tests/Fixtures/example.csv), cleans and filters the data, then writes two separate output files — one per segment — without ever loading the full file into memory.

We need to:


All versions of csv with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
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 inwebo/csv contains the following files

Loading the files please wait ...