lephare / import
Import CSV/XLS files
Installs: 2 316
Dependents: 1
Suggesters: 0
Security: 0
Stars: 4
Watchers: 8
Forks: 1
Open Issues: 4
Requires
- php: ^7.4|^8.0
- behat/transliterator: ^1.1
- doctrine/collections: ^1.6|^2.0
- doctrine/dbal: ^2.13|^3.0
- monolog/monolog: ^2.0|^3.0
- neitanod/forceutf8: ^2.0
- psr/log: ^1.0|^2.0|^3.0
- symfony/config: ^5.4|^6.0|^7.0
- symfony/event-dispatcher: ^5.4|^6.0|^7.0
- symfony/finder: ^5.4|^6.0|^7.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.3
- jangregor/phpstan-prophecy: ^1.0
- php-mock/php-mock-prophecy: ^0.1.1
- phpoffice/phpspreadsheet: ^1.19
- phpspec/prophecy: ^1.10
- phpspec/prophecy-phpunit: ^2.2
- phpstan/extension-installer: ^1.1
- phpstan/phpstan: ^1.4
- phpunit/phpunit: ^9.6
- symfony/phpunit-bridge: ^5.4|^6.0|^7.0
Suggests
- phpoffice/phpspreadsheet: Import XLS files
This package is auto-updated.
Last update: 2025-03-27 11:13:01 UTC
README
Resources
Archive
Archive affects imported files/resources when a ImportEvents::POST_COPY
event is triggered.
For archive to take effect on a imported resource, you need to explicitly define:
- the
archive.enabled
value totrue
- the
resources.references.load
node
name: stock source_dir: "var/exchange/in" archive: enabled: true dir: "var/exchange/in/foo/stock" rotation: 60 resources: references: tablename: import.stock load: pattern: "^stock.csv$"
The file will move to a default archives
directory in the defined source_dir
or in the archive.dir
if you explicitly define its value.
The archive.rotation
define define the number of files to keep before deletion.
Quarantine
Quarantine affects imported files/resources when a ImportEvents::EXCEPTION
event is triggered (before)
For quarantine to take effect on a imported resource, you need to explicitly define:
- the
quarantine.enabled
value totrue
- the
resources.references.load
node
The subsequent stock.csv
file will be quarantined if an import exception happen during the import process.
name: stock source_dir: "var/exchange/in" quarantine: enabled: true dir: "var/exchange/in/bar/stock" rotation: 60 resources: references: tablename: import.stock load: pattern: "^stock.csv$"
The file will move to a default quarantine
directory in the defined source_dir
or in the quarantine.dir
value if you explicitly define its value.
The quarantine.rotation
define define the number of files to keep before deletion.
IDE Integration
Beyond validating YAML syntax in your IDE, you can validate the definition of an import configuration using
the JSON schema ./lephare-import.schema.json
.
This also provides contextual help for autocompletion and when hovering over a YAML key.