leandroandreaci / iso8583
A module to iso8583
Installs: 6 510
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 2
Forks: 6
Open Issues: 1
Requires
- php: >=7.1.0
Requires (Dev)
- phpunit/phpunit: ^8.2@dev
This package is auto-updated.
Last update: 2024-10-22 01:26:01 UTC
README
Version: 0.3
ISO8583
This package can generate and parse messages in the ISO8583 standard.
Installation
composer require leandroandreaci/iso8583
Using
- Each new instance of the parser requires a class containing the iso message definitions.
<?php namespace Andromeda\ISO8583; use Andromeda\ISO8583\Contracts\IsoMessageContract; use Andromeda\ISO8583\MessageDefinition; class ExampleMessage extends MessageDefinition implements IsoMessageContract { public function getIso(): array { return [ 1 => ['b', 32, self::FIXED_LENGTH], 2 => ['ans', 99, self::VARIABLE_LENGTH], 3 => ['n', 6, self::FIXED_LENGTH], 4 => ['n', 12, self::FIXED_LENGTH], 5 => ['n', 12, self::FIXED_LENGTH], 6 => ['n', 12, self::FIXED_LENGTH], 7 => ['an', 10, self::FIXED_LENGTH], ]; } } /* Array definition: 1 => ['b', 32, self::FIXED_LENGTH], bit => ['type','size','is variable or fixed'] */
- Example to read a ISO8583 using a ExampleMessage in package.
$messageDefinition = new \Andromeda\ISO8583\ExampleMessage(); $parser = new \Andromeda\ISO8583\Parser($messageDefinition); //Example 01 $parser->addMessage('0800...'); $parser->validateISO(); //return false //Example 02 $parser->addMessage('0800A238000000C0000804000000000000000000010401000443495194000443040176007008043177567000140003001000'); $parser->validateISO(); //return true $parser->getBit('07'); //return 0401000443
- Example to make a ISO8583 using a ExampleMessage in package.
$message = new \Andromeda\ISO8583\ExampleMessage(); $isoMaker = new \Andromeda\ISO8583\Parser($message); $isoMaker->addMTI('0800'); $isoMaker->addData(3, '123456'); $isoMaker->addData(4, '000000001000'); $isoMaker->addData(7, '1234567890'); $isoMaker->getISO(); // return 080032000000000000001234560000000010001234567890