Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
- 'src/batch-doctrine-persistence/**'
'yokai/batch-league-flysystem':
- 'src/batch-league-flysystem/**'
'yokai/batch-openspout':
- 'src/batch-openspout/**'
'yokai/batch-symfony-console':
- 'src/batch-symfony-console/**'
'yokai/batch-symfony-framework':
Expand Down
2 changes: 2 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ changelog:
labels: ['yokai/batch-doctrine-persistence']
- title: 'Changes made to the `league/flysystem` bridge: `yokai/batch-league-flysystem`'
labels: ['yokai/batch-league-flysystem']
- title: 'Changes made to the `openspout/openspout` bridge: `yokai/batch-openspout`'
labels: ['yokai/batch-openspout']
- title: 'Changes made to the `symfony/console` bridge: `yokai/batch-symfony-console`'
labels: ['yokai/batch-symfony-console']
- title: 'Changes made to the `symfony/framework-bundle` bridge: `yokai/batch-symfony-framework`'
Expand Down
1 change: 1 addition & 0 deletions MAINTAINER.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ see https://github.com/yokai-php/batch-src/releases/tag/{created tag}
- https://github.com/yokai-php/batch-doctrine-orm/releases/new
- https://github.com/yokai-php/batch-doctrine-persistence/releases/new
- https://github.com/yokai-php/batch-league-flysystem/releases/new
- https://github.com/yokai-php/batch-openspout/releases/new
- https://github.com/yokai-php/batch-symfony-console/releases/new
- https://github.com/yokai-php/batch-symfony-framework/releases/new
- https://github.com/yokai-php/batch-symfony-messenger/releases/new
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ Some bridges to popular packages :

| Bridge with | |
|------------------------------------------------------------------------------------|----------------------------------------------------------------|
| [`box/spout`](https://github.com/yokai-php/batch-box-spout) | Read/Write from/to CSV/ODS/XLSX |
| `DEPRECATED` [`box/spout`](https://github.com/yokai-php/batch-box-spout) | Read/Write from/to CSV/ODS/XLSX |
| [`doctrine/dbal`](https://github.com/yokai-php/batch-doctrine-dbal) | Read/Write from/to SQL databases |
| [`doctrine/orm`](https://github.com/yokai-php/batch-doctrine-orm) | Read from Doctrine ORM entities |
| [`doctrine/persistence`](https://github.com/yokai-php/batch-doctrine-persistence) | Write to Doctrine ORM/ODM objects |
| [`league/flysystem`](https://github.com/yokai-php/batch-league-flysystem) | Copy/Move files in a job / Trigger job when file found |
| [`openspout/openspout`](https://github.com/yokai-php/batch-openspout) | Read/Write from/to CSV/ODS/XLSX |
| [`symfony/console`](https://github.com/yokai-php/batch-symfony-console) | Add command to trigger jobs and async job launcher via command |
| [`symfony/framework-bundle`](https://github.com/yokai-php/batch-symfony-framework) | Bundle to integrate with Symfony framework |
| [`symfony/messenger`](https://github.com/yokai-php/batch-symfony-messenger) | Trigger jobs using message dispatch |
Expand Down
4 changes: 4 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"doctrine/orm": "^2.8",
"doctrine/persistence": "^2.0|^3.0",
"league/flysystem": "^3.0",
"openspout/openspout": "^4.0",
"psr/container": "^1.0",
"psr/event-dispatcher": "^1.0",
"psr/log": "^1.0|^2.0|^3.0",
Expand Down Expand Up @@ -50,6 +51,7 @@
"yokai/batch-doctrine-orm": "self.version",
"yokai/batch-doctrine-persistence": "self.version",
"yokai/batch-league-flysystem": "self.version",
"yokai/batch-openspout": "self.version",
"yokai/batch-symfony-console": "self.version",
"yokai/batch-symfony-framework": "self.version",
"yokai/batch-symfony-messenger": "self.version",
Expand All @@ -64,6 +66,7 @@
"Yokai\\Batch\\Bridge\\Doctrine\\ORM\\": "src/batch-doctrine-orm/src/",
"Yokai\\Batch\\Bridge\\Doctrine\\Persistence\\": "src/batch-doctrine-persistence/src/",
"Yokai\\Batch\\Bridge\\League\\Flysystem\\": "src/batch-league-flysystem/src/",
"Yokai\\Batch\\Bridge\\OpenSpout\\": "src/batch-openspout/src/",
"Yokai\\Batch\\Bridge\\Symfony\\Console\\": "src/batch-symfony-console/src/",
"Yokai\\Batch\\Bridge\\Symfony\\Framework\\": "src/batch-symfony-framework/src/",
"Yokai\\Batch\\Bridge\\Symfony\\Messenger\\": "src/batch-symfony-messenger/src/",
Expand All @@ -83,6 +86,7 @@
"Yokai\\Batch\\Tests\\Bridge\\Doctrine\\ORM\\": "src/batch-doctrine-orm/tests/",
"Yokai\\Batch\\Tests\\Bridge\\Doctrine\\Persistence\\": "src/batch-doctrine-persistence/tests/",
"Yokai\\Batch\\Tests\\Bridge\\League\\Flysystem\\": "src/batch-league-flysystem/tests/",
"Yokai\\Batch\\Tests\\Bridge\\OpenSpout\\": "src/batch-openspout/tests/",
"Yokai\\Batch\\Tests\\Bridge\\Symfony\\Console\\": "src/batch-symfony-console/tests/",
"Yokai\\Batch\\Tests\\Bridge\\Symfony\\Framework\\": "src/batch-symfony-framework/tests/",
"Yokai\\Batch\\Tests\\Bridge\\Symfony\\Messenger\\": "src/batch-symfony-messenger/tests/",
Expand Down
60 changes: 60 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,66 @@ parameters:
count: 1
path: src/batch-doctrine-dbal/src/JobExecutionRowNormalizer.php

-
message: "#^Method Yokai\\\\Batch\\\\Bridge\\\\OpenSpout\\\\Reader\\\\FlatFileReader\\:\\:rows\\(\\) has parameter \\$reader with generic interface OpenSpout\\\\Reader\\\\ReaderInterface but does not specify its types\\: T$#"
count: 1
path: src/batch-openspout/src/Reader/FlatFileReader.php

-
message: "#^Parameter \\#1 \\$headers of method Yokai\\\\Batch\\\\Bridge\\\\OpenSpout\\\\Reader\\\\HeaderStrategy\\:\\:setHeaders\\(\\) expects array\\<int, string\\>, array\\<bool\\|DateInterval\\|DateTimeInterface\\|float\\|int\\|string\\|null\\> given\\.$#"
count: 1
path: src/batch-openspout/src/Reader/FlatFileReader.php

-
message: "#^Parameter \\#1 \\$options of class OpenSpout\\\\Reader\\\\CSV\\\\Reader constructor expects OpenSpout\\\\Reader\\\\CSV\\\\Options\\|null, OpenSpout\\\\Reader\\\\CSV\\\\Options\\|OpenSpout\\\\Reader\\\\ODS\\\\Options\\|OpenSpout\\\\Reader\\\\XLSX\\\\Options\\|null given\\.$#"
count: 1
path: src/batch-openspout/src/Reader/FlatFileReader.php

-
message: "#^Parameter \\#1 \\$options of class OpenSpout\\\\Reader\\\\ODS\\\\Reader constructor expects OpenSpout\\\\Reader\\\\ODS\\\\Options\\|null, OpenSpout\\\\Reader\\\\CSV\\\\Options\\|OpenSpout\\\\Reader\\\\ODS\\\\Options\\|OpenSpout\\\\Reader\\\\XLSX\\\\Options\\|null given\\.$#"
count: 1
path: src/batch-openspout/src/Reader/FlatFileReader.php

-
message: "#^Parameter \\#1 \\$options of class OpenSpout\\\\Reader\\\\XLSX\\\\Reader constructor expects OpenSpout\\\\Reader\\\\XLSX\\\\Options\\|null, OpenSpout\\\\Reader\\\\CSV\\\\Options\\|OpenSpout\\\\Reader\\\\ODS\\\\Options\\|OpenSpout\\\\Reader\\\\XLSX\\\\Options\\|null given\\.$#"
count: 1
path: src/batch-openspout/src/Reader/FlatFileReader.php

-
message: "#^Parameter \\#1 \\$row of method Yokai\\\\Batch\\\\Bridge\\\\OpenSpout\\\\Reader\\\\HeaderStrategy\\:\\:getItem\\(\\) expects array\\<int, string\\>, array\\<bool\\|DateInterval\\|DateTimeInterface\\|float\\|int\\|string\\|null\\> given\\.$#"
count: 1
path: src/batch-openspout/src/Reader/FlatFileReader.php

-
message: "#^Method Yokai\\\\Batch\\\\Bridge\\\\OpenSpout\\\\Reader\\\\SheetFilter\\:\\:list\\(\\) has parameter \\$reader with generic interface OpenSpout\\\\Reader\\\\ReaderInterface but does not specify its types\\: T$#"
count: 1
path: src/batch-openspout/src/Reader/SheetFilter.php

-
message: "#^Method Yokai\\\\Batch\\\\Bridge\\\\OpenSpout\\\\Reader\\\\SheetFilter\\:\\:list\\(\\) return type with generic interface OpenSpout\\\\Reader\\\\SheetInterface does not specify its types\\: T$#"
count: 1
path: src/batch-openspout/src/Reader/SheetFilter.php

-
message: "#^PHPDoc tag @var for variable \\$sheet contains generic interface OpenSpout\\\\Reader\\\\SheetInterface but does not specify its types\\: T$#"
count: 1
path: src/batch-openspout/src/Reader/SheetFilter.php

-
message: "#^Parameter \\#1 \\$options of class OpenSpout\\\\Writer\\\\CSV\\\\Writer constructor expects OpenSpout\\\\Writer\\\\CSV\\\\Options\\|null, OpenSpout\\\\Writer\\\\CSV\\\\Options\\|OpenSpout\\\\Writer\\\\ODS\\\\Options\\|OpenSpout\\\\Writer\\\\XLSX\\\\Options\\|null given\\.$#"
count: 1
path: src/batch-openspout/src/Writer/FlatFileWriter.php

-
message: "#^Parameter \\#1 \\$options of class OpenSpout\\\\Writer\\\\ODS\\\\Writer constructor expects OpenSpout\\\\Writer\\\\ODS\\\\Options\\|null, OpenSpout\\\\Writer\\\\CSV\\\\Options\\|OpenSpout\\\\Writer\\\\ODS\\\\Options\\|OpenSpout\\\\Writer\\\\XLSX\\\\Options\\|null given\\.$#"
count: 1
path: src/batch-openspout/src/Writer/FlatFileWriter.php

-
message: "#^Parameter \\#1 \\$options of class OpenSpout\\\\Writer\\\\XLSX\\\\Writer constructor expects OpenSpout\\\\Writer\\\\XLSX\\\\Options\\|null, OpenSpout\\\\Writer\\\\CSV\\\\Options\\|OpenSpout\\\\Writer\\\\ODS\\\\Options\\|OpenSpout\\\\Writer\\\\XLSX\\\\Options\\|null given\\.$#"
count: 1
path: src/batch-openspout/src/Writer/FlatFileWriter.php

-
message: "#^Cannot access offset 'connection' on mixed\\.$#"
count: 1
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ parameters:
- src/batch-doctrine-orm/src/
- src/batch-doctrine-persistence/src/
- src/batch-league-flysystem/src/
- src/batch-openspout/src/
- src/batch-symfony-console/src/
- src/batch-symfony-framework/src/
- src/batch-symfony-messenger/src/
Expand Down
2 changes: 2 additions & 0 deletions scripts/split-branch
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ remote batch-doctrine-dbal git@github.com:yokai-php/batch-doctrine-dbal.g
remote batch-doctrine-orm git@github.com:yokai-php/batch-doctrine-orm.git
remote batch-doctrine-persistence git@github.com:yokai-php/batch-doctrine-persistence.git
remote batch-league-flysystem git@github.com:yokai-php/batch-league-flysystem.git
remote batch-openspout git@github.com:yokai-php/batch-openspout.git
remote batch-symfony-console git@github.com:yokai-php/batch-symfony-console.git
remote batch-symfony-framework git@github.com:yokai-php/batch-symfony-framework.git
remote batch-symfony-messenger git@github.com:yokai-php/batch-symfony-messenger.git
Expand All @@ -43,6 +44,7 @@ split 'src/batch-doctrine-dbal' batch-doctrine-dbal
split 'src/batch-doctrine-orm' batch-doctrine-orm
split 'src/batch-doctrine-persistence' batch-doctrine-persistence
split 'src/batch-league-flysystem' batch-league-flysystem
split 'src/batch-openspout' batch-openspout
split 'src/batch-symfony-console' batch-symfony-console
split 'src/batch-symfony-framework' batch-symfony-framework
split 'src/batch-symfony-messenger' batch-symfony-messenger
Expand Down
2 changes: 2 additions & 0 deletions scripts/split-tag
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ remote batch-doctrine-dbal git@github.com:yokai-php/batch-doctrine-dbal.g
remote batch-doctrine-orm git@github.com:yokai-php/batch-doctrine-orm.git
remote batch-doctrine-persistence git@github.com:yokai-php/batch-doctrine-persistence.git
remote batch-league-flysystem git@github.com:yokai-php/batch-league-flysystem.git
remote batch-openspout git@github.com:yokai-php/batch-openspout.git
remote batch-symfony-console git@github.com:yokai-php/batch-symfony-console.git
remote batch-symfony-framework git@github.com:yokai-php/batch-symfony-framework.git
remote batch-symfony-messenger git@github.com:yokai-php/batch-symfony-messenger.git
Expand All @@ -43,6 +44,7 @@ split 'src/batch-doctrine-dbal' batch-doctrine-dbal
split 'src/batch-doctrine-orm' batch-doctrine-orm
split 'src/batch-doctrine-persistence' batch-doctrine-persistence
split 'src/batch-league-flysystem' batch-league-flysystem
split 'src/batch-openspout' batch-openspout
split 'src/batch-symfony-console' batch-symfony-console
split 'src/batch-symfony-framework' batch-symfony-framework
split 'src/batch-symfony-messenger' batch-symfony-messenger
Expand Down
7 changes: 7 additions & 0 deletions src/batch-box-spout/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
[`box/spout`](https://github.com/box/spout) bridge for [Batch](https://github.com/yokai-php/batch) processing library.


## :warning: DEPRECATED

This library is deprecated because the package it relies on was also deprecated.
The library has been replaced with [`openspout/openspout`](https://github.com/openspout/openspout).
And this bridge was replaced with [`yokai/batch-openspout`](https://github.com/yokai-php/batch-openspout).


## :warning: BETA

This library is following [semver](https://semver.org/).
Expand Down
2 changes: 1 addition & 1 deletion src/batch-box-spout/tests/Writer/FlatFileWriterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

class FlatFileWriterTest extends TestCase
{
private const WRITE_DIR = ARTIFACT_DIR . '/flat-file-writer';
private const WRITE_DIR = ARTIFACT_DIR . '/box-spout-flat-file-writer';

/**
* @dataProvider sets
Expand Down
6 changes: 6 additions & 0 deletions src/batch-openspout/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.gitattributes export-ignore
.gitignore export-ignore
docs/ export-ignore
tests/ export-ignore
LICENSE export-ignore
*.md export-ignore
27 changes: 27 additions & 0 deletions src/batch-openspout/.github/workflows/lockdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: 'Lock down Pull Requests'

on:
pull_request:
types: opened

jobs:
lockdown:
runs-on: ubuntu-latest
steps:
- uses: dessant/repo-lockdown@v2
with:
github-token: ${{ github.token }}
close-pr: true
lock-pr: true
pr-comment: >
Thanks for your pull request!

However, this repository does not accept pull requests,
see the README for details.

If you want to contribute,
you should instead open a pull request on the main repository:

https://github.com/yokai-php/batch-src

Thank you
4 changes: 4 additions & 0 deletions src/batch-openspout/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/.phpunit.result.cache
/tests/.artifacts/
/vendor/
/composer.lock
19 changes: 19 additions & 0 deletions src/batch-openspout/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2019 Yann Eugoné

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
46 changes: 46 additions & 0 deletions src/batch-openspout/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# box/spout bridge for Batch processing library

[![Latest Stable Version](https://img.shields.io/packagist/v/yokai/batch-openspout?style=flat-square)](https://packagist.org/packages/yokai/batch-openspout)
[![Downloads Monthly](https://img.shields.io/packagist/dm/yokai/batch-openspout?style=flat-square)](https://packagist.org/packages/yokai/batch-openspout)

[`openspout/openspout`](https://github.com/openspout/openspout) bridge for [Batch](https://github.com/yokai-php/batch) processing library.


## :warning: BETA

This library is following [semver](https://semver.org/).
However before we reach the first stable version (`v1.0.0`), we may decide to introduce **API changes in minor versions**.
This is why you should stick to a `v0.[minor].*` requirement !


# Installation

```
composer require yokai/batch-openspout
```


## Documentation

This package provides:

- a [item reader](docs/flat-file-item-reader.md) that read from CSV/XLSX/ODS files
- a [item writer](docs/flat-file-item-writer.md) that write to CSV/XLSX/ODS files


## Contribution

This package is a readonly split of a [larger repository](https://github.com/yokai-php/batch-src),
containing all tests and sources for all librairies of the batch universe.

Please feel free to open an [issue](https://github.com/yokai-php/batch-src/issues)
or a [pull request](https://github.com/yokai-php/batch-src/pulls)
in the [main repository](https://github.com/yokai-php/batch-src).

The library was originally created by [Yann Eugoné](https://github.com/yann-eugone).
See the list of [contributors](https://github.com/yokai-php/batch-src/contributors).


## License

This library is under MIT [LICENSE](LICENSE).
32 changes: 32 additions & 0 deletions src/batch-openspout/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "yokai/batch-openspout",
"description": "openspout/openspout bridge for yokai/batch",
"keywords": ["batch", "job", "reader", "writer", "flat", "csv", "xlsx", "ods"],
"type": "library",
"license": "MIT",
"authors": [
{
"name": "Yann Eugoné",
"email": "eugone.yann@gmail.com"
}
],
"require": {
"php": "^8.0",
"openspout/openspout": "^4.0",
"yokai/batch": "^0.5.0"
},
"autoload": {
"psr-4": {
"Yokai\\Batch\\Bridge\\OpenSpout\\": "src/"
}
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"symfony/filesystem": "^5.0|^6.0"
},
"autoload-dev": {
"psr-4": {
"Yokai\\Batch\\Tests\\Bridge\\OpenSpout\\": "tests/"
}
}
}
48 changes: 48 additions & 0 deletions src/batch-openspout/docs/flat-file-item-reader.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Item reader with CSV/ODS/XLSX files

The [FlatFileReader](../src/Reader/FlatFileReader.php) is a reader
that will read from CSV/ODS/XLSX file and return each line as an array.

```php
<?php

use OpenSpout\Reader\CSV\Options as CSVOptions;
use OpenSpout\Reader\ODS\Options as ODSOptions;
use OpenSpout\Reader\XLSX\Options as XLSXOptions;
use Yokai\Batch\Bridge\OpenSpout\Reader\FlatFileReader;
use Yokai\Batch\Bridge\OpenSpout\Reader\HeaderStrategy;
use Yokai\Batch\Bridge\OpenSpout\Reader\SheetFilter;
use Yokai\Batch\Job\Parameters\StaticValueParameterAccessor;

// Read .xlsx file
// Every sheet will be read
// All lines will be read as simple array
new FlatFileReader(new StaticValueParameterAccessor('/path/to/file.xlsx'));

// Read .csv file
// The CSV delimiter and enclosure has been changed from default (respectively ',' & '"')
// Each lines will be read as simple array
$options = new CSVOptions();
$options->FIELD_DELIMITER = ';';
$options->FIELD_ENCLOSURE = '|';
new FlatFileReader(
new StaticValueParameterAccessor('/path/to/file.csv'),
$options,
null,
HeaderStrategy::none(),
);

// Read .ods file
// Only sheet named "Sheet name to read" will be read
// Each item will be an array_combine of first line as key and line as values
new FlatFileReader(
new StaticValueParameterAccessor('/path/to/file.ods'),
null,
SheetFilter::nameIs('Sheet name to read'),
HeaderStrategy::combine(),
);
```

## On the same subject

- [What is an item reader ?](https://github.com/yokai-php/batch/blob/0.x/docs/domain/item-job/item-reader.md)
Loading