PHP code example of jcoded / atoc-data-parser

1. Go to this page and download the library: Download jcoded/atoc-data-parser library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jcoded / atoc-data-parser example snippets


$filename = "RJFAF570.NDF";
$factory = new \JCoded\AtocDataParser\Factory();
$parser = $factory->getParser($filename);

while (($line = fgets($stream)) !== false) {
    //Skip the comments
    if (strpos($line, '/!!') !== false) {
        continue;
    }

    //Get the data
    try {
        $data = $parser->parseLine($line);

        //Do something with the data

    } catch (\JCoded\AtocDataParser\IncompatibleLineException $ex) {
        //Handle exception
    }
}

[
    'TICKET_CODE' => '0AW',
    'RESTRICTION_CODE' => 'SV',
    'RESTRICTION_FLAG' => '0',
    'TOC_ID' => 'SN',
    'END_DATE' => '31122999',
    'START_DATE' => '30042013',
    'CHECK_TYPE' => '2',
    'AP_DATA' => '00000001',
    'BOOKING_TIME' => '1800',
    'RECORD_IDENTITY' => 'TAP'
]

\JCoded\AtocDataParser\ParserFactoryInterface

\JCoded\AtocDataParser\File\ParserInterface