designbeat / csv-matcher
Installs: 3 995
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=5.5
Requires (Dev)
- nette/tester: ~1.5.0
This package is not auto-updated.
Last update: 2019-10-28 12:48:08 UTC
README
Install
$ composer require designbeat/csv-matcher
Usage
See more in tests.
use DesignBeat\Matchers\CSV\CsvMatcher; use DesignBeat\Matchers\CSV\CsvReader; $scheme = [ 0 => 'user.name', 1 => 'user.surname', 2 => 'city', 3 => 'extra.id', 4 => 'extra.x', ]; $matcher = new CsvMatcher(new CsvReader(__DIR__ . '/tests/cases/files/fixtures.csv')); $result = $matcher->match($scheme);
Result is:
0 => [ 'user' => [ 'name' => 'Milan', 'surname' => 'Sulc', ], 'city' => 'HK', 'extra' => [ 'id' => '123456', 'x' => 'foo', ], ], 1 => [ 'user' => [ 'name' => 'John', 'surname' => 'Doe', ], 'city' => 'Doens', 'extra' => [ 'id' => '111111', 'x' => 'bar', ], ],