PHPackages                             mczolko/atoc-feed-parser - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. mczolko/atoc-feed-parser

ActivePackage[Parsing &amp; Serialization](/categories/parsing)

mczolko/atoc-feed-parser
========================

A parser for the ATOC data feed files.

0473PHP

Since Jul 14Pushed 10y ago1 watchersCompare

[ Source](https://github.com/mCzolko/atoc-feed-parser)[ Packagist](https://packagist.org/packages/mczolko/atoc-feed-parser)[ RSS](/packages/mczolko-atoc-feed-parser/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

ATOC Feed Parser
================

[](#atoc-feed-parser)

This package allows you to parse the timetable and fares files contained within the ATOC data feed download available at

It does not parse files that are identified as not maintained in the ATOC specification document.

Installation
------------

[](#installation)

You can install this package through Composer. Add the following line to your composer.json `require` object:

```
"mczolko/atoc-feed-parser": "dev-master"

```

Record identity
---------------

[](#record-identity)

A field has been added to each record to help easily identify it, when using a Repository service for example. From the record identity it is possible to map the record to a table in your database. The record identity is constructed from the file extension followed by the `RECORD_TYPE` if present.

Field naming
------------

[](#field-naming)

To create information that is easier to consume some field names vary from the specification to keep them uniform, the table below details the field name to expect from this parser and which field that relates to in the specification.

Parser fieldTimetable feedFares feedDescriptionRECORD\_TYPERecord identityRECORD\_TYPEOptionally included in the feed specificationRECORD\_IDENTITYThe identity given by this parserUsage
-----

[](#usage)

To get a parser object use the Factory based on the filename being parsed:

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

Then use the parser object to loop through each of the lines of the file.

```
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\ATOCFeedParser\IncompatibleLineException $ex) {
        //Handle exception
    }
}
```

The parser will return an associative array with a key equal to the field name in the specification document, see the example below. The specification documents can be found on the ATOC site.

```
[
    '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'
]
```

### Dependency injection

[](#dependency-injection)

There are a some interfaces to use when injecting dependencies into your classes.

The interface for the Factory:

```
\JCoded\ATOCFeedParser\ParserFactoryInterface
```

The interface for the returned parser:

```
\JCoded\ATOCFeedParser\File\ParserInterface
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 62.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/b47e1513af183fdc4c4610974d11ac97b5db55139035ca2ca579ccfec8fed970?d=identicon)[mczolko](/maintainers/mczolko)

---

Top Contributors

[![mCzolko](https://avatars.githubusercontent.com/u/1011500?v=4)](https://github.com/mCzolko "mCzolko (5 commits)")[![madebyjames](https://avatars.githubusercontent.com/u/8142061?v=4)](https://github.com/madebyjames "madebyjames (3 commits)")

### Embed Badge

![Health badge](/badges/mczolko-atoc-feed-parser/health.svg)

```
[![Health](https://phpackages.com/badges/mczolko-atoc-feed-parser/health.svg)](https://phpackages.com/packages/mczolko-atoc-feed-parser)
```

###  Alternatives

[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M65](/packages/sabberworm-php-css-parser)[jms/metadata

Class/method/property metadata management in PHP

1.8k152.8M88](/packages/jms-metadata)[jms/serializer-bundle

Allows you to easily serialize, and deserialize data of any complexity

1.8k89.3M627](/packages/jms-serializer-bundle)[hassankhan/config

Lightweight configuration file loader that supports PHP, INI, XML, JSON, and YAML files

97513.5M170](/packages/hassankhan-config)[meyfa/php-svg

Read, edit, write, and render SVG files with PHP

54613.9M42](/packages/meyfa-php-svg)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
