PHPackages                             martinoak/dot-code-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. martinoak/dot-code-parser

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

martinoak/dot-code-parser
=========================

Parse tire DOT codes into factory code, size code, week and year of manufacture.

1.0.3(1mo ago)09↓75%MITPHPPHP ^8.2

Since Jul 15Pushed 1mo agoCompare

[ Source](https://github.com/martinoak/dot-code-parser)[ Packagist](https://packagist.org/packages/martinoak/dot-code-parser)[ Docs](https://github.com/martinoak/dot-code-parser)[ RSS](/packages/martinoak-dot-code-parser/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (1)Versions (5)Used By (0)

dot-code-parser
===============

[](#dot-code-parser)

Parse tire **DOT codes** (Tire Identification Numbers) into their component parts: factory/plant code, size code, optional manufacturer block, and the week + year of manufacture. Includes a bundled lookup of well-known plant codes to manufacturer names and locations.

A tire DOT code looks like `DOT H3LN JJ1R 0226` and follows the NHTSA structure:

```
[DOT] [Plant(2-3)] [Size(2)] [Optional(0-4)] [Week(2)] [Year(2)]

```

The TIN was standardized to 13 symbols for new tires in April 2015.

Requirements
------------

[](#requirements)

- PHP 8.2+

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

[](#installation)

```
composer require martinoak/dot-code-parser
```

Usage
-----

[](#usage)

### Parsing

[](#parsing)

```
use Martinoak\DotCodeParser\DotCodeParser;

$parser = new DotCodeParser();

$dot = $parser->parse('DOT 1HD 2A 021X 1225');

$dot->factoryCode;  // "1HD"
$dot->sizeCode;     // "2A"
$dot->optionalCode; // "021X"
$dot->week;         // 12
$dot->year;         // 2025
$dot->plantName;    // "Michelin Italiana — Cuneo, Italy"
$dot->brand();      // "michelin"
$dot->dateCode();   // "1225"
```

Input is normalized automatically — a leading `DOT` prefix, spaces and other separators are stripped, and the code is uppercased. So all of these parse identically:

```
$parser->parse('H3LN JJ1R 0226');
$parser->parse('DOT H3LN JJ1R 0226');
$parser->parse('h3lnjj1r0226');
```

### Handling invalid input

[](#handling-invalid-input)

`parse()` throws `InvalidDotCodeException` on malformed input:

```
use Martinoak\DotCodeParser\InvalidDotCodeException;

try {
    $parser->parse('not-a-code');
} catch (InvalidDotCodeException $e) {
    // handle it
}
```

Prefer `tryParse()` when you'd rather get `null` than an exception:

```
$dot = $parser->tryParse($userInput); // DotCode|null
```

### The `DotCode` value object

[](#the-dotcode-value-object)

`DotCode` is immutable. Available data and helpers:

MemberTypeDescription`$factoryCode``string`Plant code (2 or 3 chars)`$sizeCode``string`Tire size code (2 chars)`$optionalCode``string`Optional manufacturer block (0–4 chars)`$week``int`Week of manufacture (1–53)`$year``int`Full year of manufacture, e.g. `2025``$plantName``?string`Resolved plant/manufacturer, or `null``dateCode()``string`Reconstructed `WWYY` date block, e.g. `1225``brand()``?string`Normalized brand slug, or `null``toArray()``array`All of the above as an array`brand()` returns a normalized slug (e.g. `michelin`, `continental`, `nokian`) derived from the plant name, mapping sub-brands to their parent group (e.g. `Dębica` → `goodyear`, `Metzeler` → `pirelli`). It returns `null` for unknown plants — useful as a stable key for mapping to a logo.

Plant code lookup
-----------------

[](#plant-code-lookup)

The bundled `PlantCodes` table maps DOT plant codes to manufacturer + location for the major makers (Michelin, Bridgestone, Goodyear, Continental, Pirelli, Hankook, Nokian, Barum, and more). Both the legacy 2-symbol codes and the newer NHTSA 3-symbol codes are covered.

```
use Martinoak\DotCodeParser\PlantCodes;

PlantCodes::name('1HD'); // "Michelin Italiana — Cuneo, Italy"
PlantCodes::name('ZZZ'); // null
PlantCodes::all();       // array of the whole table
```

Codes not in the table resolve to `null` — the raw factory code is still returned by the parser, so parsing degrades gracefully. The authoritative, complete list is published free by NHTSA vPIC (GetEquipmentPlantCodes).

Testing
-------

[](#testing)

```
composer install
composer test
```

License
-------

[](#license)

Released under the [MIT License](LICENSE).

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance90

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

###  Release Activity

Cadence

Every ~0 days

Total

4

Last Release

46d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/49438284?v=4)[Martin Dub](/maintainers/MartinOak)[@martinoak](https://github.com/martinoak)

---

Top Contributors

[![martinoak](https://avatars.githubusercontent.com/u/49438284?v=4)](https://github.com/martinoak "martinoak (4 commits)")

---

Tags

dotparsertintyretiredot-code

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/martinoak-dot-code-parser/health.svg)

```
[![Health](https://phpackages.com/badges/martinoak-dot-code-parser/health.svg)](https://phpackages.com/packages/martinoak-dot-code-parser)
```

###  Alternatives

[nikic/php-parser

A PHP parser written in PHP

17.5k992.9M2.9k](/packages/nikic-php-parser)[doctrine/lexer

PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.

11.1k980.3M180](/packages/doctrine-lexer)[erusev/parsedown

Parser for Markdown.

15.1k160.1M952](/packages/erusev-parsedown)[league/commonmark

Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)

3.0k464.7M1.3k](/packages/league-commonmark)[masterminds/html5

An HTML5 parser and serializer.

1.8k291.1M378](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k227.1M81](/packages/sabberworm-php-css-parser)

PHPackages © 2026

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