Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rap2hpoutre/csv-to-associative-array

Get your CSV as an associative array
https://github.com/rap2hpoutre/csv-to-associative-array

array composer csv php

Last synced: 24 days ago
JSON representation

Get your CSV as an associative array

Awesome Lists containing this project

README

        

# CSV to associative array

This package only contains a 587 bytes function: `csv_to_associative_array`.

## What?

Get your CSV file as an associative array. From this:

```csv
name,email
raphael,[email protected]
lisa,[email protected]
```

To this:
```php
[
['name' => 'raphael', 'email' => '[email protected]'],
['name' => 'lisa', 'email' => '[email protected]']
]
```

## How?

Install via composer
```
composer require rap2hpoutre/csv-to-associative-array
```

Use
```
$content = \Rap2hpoutre\Csv\csv_to_associative_array('path/to/csv/file.csv');
```