Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kubinyete/adiq-edi-php
A standard library for loading EDI files from Adiq.
https://github.com/kubinyete/adiq-edi-php
adiq edi library parsing php php8
Last synced: about 1 month ago
JSON representation
A standard library for loading EDI files from Adiq.
- Host: GitHub
- URL: https://github.com/kubinyete/adiq-edi-php
- Owner: Kubinyete
- Created: 2023-10-10T20:19:00.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-09-17T17:49:19.000Z (about 2 months ago)
- Last Synced: 2024-10-12T13:20:23.266Z (about 1 month ago)
- Topics: adiq, edi, library, parsing, php, php8
- Language: PHP
- Homepage:
- Size: 28.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# **EDI** for PHP
**pt-BR**: Uma biblioteca simples e direta para carregar arquivos EDI da adquirente [Adiq Pagamentos](https://www.adiq.com.br/)
**en-US**: A straightfoward library for loading EDI files from [Adiq Pagamentos](https://www.adiq.com.br/)
***NOTA**: Este guia está primariamente em inglês, caso haja necessidade, será adicionado uma versão em pt-BR no futuro.*
---
### Installation
Let's start by requiring the package by running the following command
```sh
composer require kubinyete/adiq-edi-php
```### Usage
You can just instantiate a new document object from a data stream, after that, you should be able to directly
check each envelope that is present on file, and iterate over each entry accordingly.```php
// Opening the document by providing a file path
$document = Document::open(__DIR__ . DIRECTORY_SEPARATOR . 'EDI_020_20231001_11111_0011_001111111_000111.txt');
// Metadata information can be found via
$metadata = $document->getMetadata();dump([
'fileVersion' => $metadata->version,
'fileDate' => $metadata->date,
'movement' => $metadata->movement,
'acquirerName' => $metadata->acquirer,
'establishmentCode' => $metadata->establishmentCode,
]);// For each envelope available
foreach ($document->getEnvelopes() as $envelope) {
/** @var Envelope $envelope */
dump([
'envelopeDate' => $envelope->date,
'envelopeCurrencyCode' => $envelope->currencyCode,
'entriesCount' => $envelope->registryTotalCount,
'entriesCreditSum' => $envelope->registryTotalCreditAmount,
]);// For each entry (CV, AJ, CC) inside our envelope.
foreach ($envelope->getEntries() as $entry) {
/** @var EDIRegistry $entry */
dump($registry);
}
}
```