Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/smichaelsen/caldera-php
https://github.com/smichaelsen/caldera-php
Last synced: 30 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/smichaelsen/caldera-php
- Owner: smichaelsen
- Created: 2018-08-03T17:42:36.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2024-02-06T09:53:31.000Z (11 months ago)
- Last Synced: 2024-11-18T09:58:07.058Z (about 1 month ago)
- Language: PHP
- Size: 29.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Caldera - PHP Data Import Tool
Caldera helps you to import data from sources like XML or CSV, to map, transform and validate them according to your needs and provides them with small memory footprint.
```
$csvInputGenerator = new \Smichaelsen\Caldera\InputGenerator\CsvInputGenerator();
$csvInputGenerator->setCsvHandle(fopen(__DIR__ . '/test-equestrian.csv', 'r'));foreach (\Smichaelsen\Caldera\RecordMapper::mapRecords(
$csvInputGenerator,
new MyMappingClass()
) as $record) {
// $record is mapped, validated and processed according to rules in your MyMappingClass()
}
```Caldera works line by line (record by record) when possible (not possible with XML) and this way saves memory.
This enables you to import data from a huge CSV file for example.## Run tests:
```
composer update --prefer-lowest --prefer-stable
./vendor/bin/phpunit --bootstrap vendor/autoload.php tests
composer update
./vendor/bin/phpunit --bootstrap vendor/autoload.php tests
```