Skip to content

Commit

Permalink
upgrade vendor[skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
jnunez95 committed Jul 25, 2023
1 parent 51ee2d5 commit 59ce628
Show file tree
Hide file tree
Showing 17 changed files with 706 additions and 359 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/vendor
/composer.lock
/.idea
/build
/composer.lock
.phpunit.result.cache
17 changes: 11 additions & 6 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
build:
nodes:
analysis:
tests:
override:
- php-scrutinizer-run

filter:
excluded_paths: [tests, vendor]
excluded_paths:
- tests
dependency_paths:
- vendor

checks:
php:
Expand All @@ -16,8 +26,3 @@ checks:
fix_line_ending: true
fix_identation_4spaces: true
fix_doc_comments: true

tools:
external_code_coverage:
timeout: 1800
runs: 3
11 changes: 6 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
language: php

php:
- 7.1
- 7.1.0
- 7.2.0
- 7.3.0
- 7.4.0
- 8.0.0
- 8.1.0

install:
- travis_retry composer install --no-interaction --prefer-source

script:
- vendor/bin/phpunit

after_script:
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 Raphaël Huchet (a.k.a rap2h / rap2hpoutre)
Copyright (c) 2017-present Raphaël Huchet (rap2h, rap2hpoutre)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
57 changes: 47 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@

[![Version](https://poser.pugx.org/rap2hpoutre/fast-excel/version?format=flat)](https://packagist.org/packages/rap2hpoutre/fast-excel)
[![License](https://poser.pugx.org/rap2hpoutre/fast-excel/license?format=flat)](https://packagist.org/packages/rap2hpoutre/fast-excel)
[![Build Status](https://travis-ci.org/rap2hpoutre/fast-excel.svg?branch=master)](https://travis-ci.org/rap2hpoutre/fast-excel)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/rap2hpoutre/fast-excel/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/rap2hpoutre/fast-excel/?branch=master)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/4814d15bf1a545b99c90dc07917d7ec9)](https://www.codacy.com/app/rap2hpoutre/fast-excel?utm_source=github.com&utm_medium=referral&utm_content=rap2hpoutre/fast-excel&utm_campaign=Badge_Grade)
[![StyleCI](https://github.styleci.io/repos/128174809/shield?branch=master)](https://github.styleci.io/repos/128174809?branch=master)
[![Tests](https://github.com/rap2hpoutre/fast-excel/actions/workflows/tests.yml/badge.svg)](https://github.com/rap2hpoutre/fast-excel/actions/workflows/tests.yml)
[![Total Downloads](https://poser.pugx.org/rap2hpoutre/fast-excel/downloads)](https://packagist.org/packages/rap2hpoutre/fast-excel)

Fast Excel import/export for Laravel, thanks to [Spout](https://github.com/box/spout).
Expand Down Expand Up @@ -82,7 +81,7 @@ $collection = (new FastExcel)->import('file.xlsx');
Import a `csv` with specific delimiter, enclosure characters and "gbk" encoding:

```php
$collection = (new FastExcel)->configureCsv(';', '#', '\n', 'gbk')->import('file.csv');
$collection = (new FastExcel)->configureCsv(';', '#', 'gbk')->import('file.csv');
```

Import and insert to database:
Expand Down Expand Up @@ -160,14 +159,53 @@ You can also import a specific sheet by its number:
$users = (new FastExcel)->sheet(3)->import('file.xlsx');
```

Import multiple sheets with sheets names:

```php
$sheets = (new FastExcel)->withSheetsNames()->importSheets('file.xlsx');
```

### Export large collections with chunk

Export rows one by one to avoid `memory_limit` issues [using `yield`](https://www.php.net/manual/en/language.generators.syntax.php):

```php
function usersGenerator() {
foreach (User::cursor() as $user) {
yield $user;
}
}

// Export consumes only a few MB, even with 10M+ rows.
(new FastExcel(usersGenerator()))->export('test.xlsx');
```

### Add header and rows style

Add header and rows style with `headerStyle` and `rowsStyle` methods.

```php
use OpenSpout\Common\Entity\Style\Style;

$header_style = (new Style())->setFontBold();

$rows_style = (new Style())
->setFontSize(15)
->setShouldWrapText()
->setBackgroundColor("EDEDED");

return (new FastExcel($list))
->headerStyle($header_style)
->rowsStyle($rows_style)
->download('file.xlsx');
```

## Why?

FastExcel is intended at being Laravel-flavoured [Spout](https://github.com/box/spout):
a simple, but elegant wrapper around [Spout](https://github.com/box/spout) with the goal
of simplifying **imports and exports**.

It could be considered as a faster (and memory friendly) alternative
to [Laravel Excel](https://laravel-excel.maatwebsite.nl/), with less features.
of simplifying **imports and exports**. It could be considered as a faster (and memory friendly) alternative
to [Laravel Excel](https://laravel-excel.com/), with less features.
Use it only for simple tasks.

## Benchmarks
Expand All @@ -180,5 +218,4 @@ Testing a XLSX export for 10000 lines, 20 columns with random data, 10 iteration
| Laravel Excel | 123.56 M | 11.56 s |
| FastExcel | 2.09 M | 2.76 s |

Still, remember that [Laravel Excel](https://laravel-excel.maatwebsite.nl/) **has many more feature.**
Please help me improve benchmarks, more tests are coming. Feel free to criticize.
Still, remember that [Laravel Excel](https://laravel-excel.com/) **has many more features.**
91 changes: 51 additions & 40 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,54 @@
{
"name": "smart145/fast-excel",
"type": "library",
"keywords": [
"laravel",
"excel",
"csv",
"xls",
"xlsx"
],
"description": "Fast Excel import/export for Laravel",
"require": {
"php": "8.*",
"illuminate/database": "5.* || 6.* || 7.* || 8.* || 9.*",
"illuminate/support": "5.* || 6.* || 7.* || 8.* || 9.*",
"smart145/spout": "2.7.9"
},
"require-dev": {
"phpunit/phpunit": "^9.5"
},
"autoload": {
"psr-4": {
"Smart145\\FastExcel\\": "src/"
"name": "smart145/fast-excel",
"type": "library",
"keywords": [
"laravel",
"excel",
"csv",
"xls",
"xlsx"
],
"description": "Fast Excel import/export for Laravel",
"require": {
"php": "^8.0",
"illuminate/support": "^6.0 || ^7.0 || ^8.0 || ^9.0|^10.0",
"smart145/spout": "2.7.9"
},
"files": [
"src/functions/fastexcel.php"
]
},
"autoload-dev": {
"psr-4": {
"Smart145\\FastExcel\\Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"providers": [
"Smart145\\FastExcel\\Providers\\FastExcelServiceProvider"
]
}
},
"license": "MIT",
"minimum-stability": "stable"
"require-dev": {
"illuminate/database": "^6.20.12 || ^7.30.4 || ^8.24.0 || ^9.0|^10.0",
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "3.*"
},
"autoload": {
"psr-4": {
"Smart145\\FastExcel\\": "src/"
},
"files": [
"src/functions/fastexcel.php"
]
},
"autoload-dev": {
"psr-4": {
"Smart145\\FastExcel\\Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"providers": [
"Smart145\\FastExcel\\Providers\\FastExcelServiceProvider"
]
}
},
"scripts": {
"test": "vendor/bin/phpunit tests"
},
"license": "MIT",
"authors": [
{
"name": "rap2h",
"email": "[email protected]"
}
],
"minimum-stability": "dev",
"prefer-stable": true
}
29 changes: 13 additions & 16 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true" bootstrap="./vendor/autoload.php" convertNoticesToExceptions="true" convertWarningsToExceptions="true" stopOnError="false" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true">
<testsuites>
<testsuite name="all">
<directory suffix="Test.php">tests/</directory>
<testsuite name="Unit">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
<logging>
<log type="tap" target="build/report.tap"/>
<log type="junit" target="build/report.junit.xml"/>
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
<log type="coverage-text" target="build/coverage.txt"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
</phpunit>

<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./app</directory>
</include>
</coverage>
</phpunit>
Loading

0 comments on commit 59ce628

Please sign in to comment.