Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/progerxp/excelife
PHP parser for Excel tables into trees using simple rules and chaned calls.
https://github.com/progerxp/excelife
Last synced: about 2 months ago
JSON representation
PHP parser for Excel tables into trees using simple rules and chaned calls.
- Host: GitHub
- URL: https://github.com/progerxp/excelife
- Owner: ProgerXP
- Created: 2013-10-31T13:28:36.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2013-10-31T13:43:13.000Z (about 11 years ago)
- Last Synced: 2023-03-23T09:24:56.924Z (almost 2 years ago)
- Language: PHP
- Size: 121 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Excelife
**Excelife** parses Excel tables into trees using simple rules and chained calls.
It requires **excel_reader2** (included) and works out of the box with **PHP 5.3 and up** - simply include it and you're ready to go. Bundle for Laravel 3 is provided for easy autoloading.
**Unless you're using Laravel Excelife is just a single file (`excelife.php`) plus `excel_reader2.php`.**
## [Laravel bundle](http://bundles.laravel.com/bundle/excelife)
```
php artisan bundle:install excelife
```## Example
The complete source code and sample data are available in `example` directory. You don't need it for Excelife to work. A snippet from there:
```
$rows = Excelife::make('data.xls')
->toAfter(0, '�')
->match(function ($cells, $row) {
if ($row->bgColor(1) === 'FFFF99') {
return new Group($row, $cells[1]);
}
})
->match(function ($cells, $row) {
if ($row->color(0) === 'FF9900') {
return new Unavailable($row);
} else {
return new Product($row, array('sku', 'title', 'retail', 'wholesale'));
}
})
->parse()
->get();
```