martinoak/dot-code-parser
Composer 安装命令:
composer require martinoak/dot-code-parser
包简介
Parse tire DOT codes into factory code, size code, week and year of manufacture.
README 文档
README
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
- PHP 8.2+
Installation
composer require martinoak/dot-code-parser
Usage
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
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
DotCode is immutable. Available data and helpers:
| Member | Type | Description |
|---|---|---|
$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
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<string, string> 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
composer install
composer test
License
Released under the MIT License.
martinoak/dot-code-parser 适用场景与选型建议
martinoak/dot-code-parser 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 07 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「parser」 「dot」 「tyre」 「tire」 「tin」 「dot-code」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 martinoak/dot-code-parser 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 martinoak/dot-code-parser 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 martinoak/dot-code-parser 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Easy to use SDK with grabber for multiple platforms at once like YouTube, Dailymotion, Facebook and more.
Access array data quickly/easily using dot-notation and asterisk.
A GraphViz generator for PHP. PEAR Image_GraphViz rethought.
An MT940 bank statement parser for PHP
Laravel integration for the jsonapi.org parser
Library to access nested object properties by providing a string
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-15